Skip to content
Advertisement

Tag: readonly

In Kotlin, how does GSON.fromJson(…) manage to mutate a read-only field of an existing object?

In Kotlin, how can an instance’s read-only val field be mutated? In the following Kotlin code, gson.fromJson(…) gets a Thing(0) from the InstanceCreator and somehow manages to mutate value from 0 to 1, then return that object. How? I verified that the object returned by gson.fromJson(…) is the same object provided by the InstanceCreator, so it’s not creating a new

How close possibility to add new data in H2?

I have a problem. After adding some data to database, I need to set read-only mode for whole DB. What is the easiest way to do that using h2 embedded DB with driver manager (jdbc)? Answer You can open the whole database in read-only mode by appending ;ACCESS_MODE_DATA=r to the JDBC URL (“jdbc:h2:” + “./” + dbName + “;ACCESS_MODE_DATA=r” in

setReadOnly not working on PostgreSQL Connection

I have a problem setting a read-only connection with a PostgreSQL database using JDBC. I’m creating an application which loads queries to execute from a file, and I want to execute only SELECT (read-only) queries. Setting permissions on users who will run the application is not an option, so setting permissions at code level through the Connection.setReadOnly(boolean) method was the

Advertisement