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
Tag: readonly
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
Java / Hibernate – Write operations are not allowed in read-only mode
I’ve been having an annoying exception a lot lately, and after some research on Google and this forum I still haven’t found an answer that could solve my problem. Here’s the thing – sometimes, I get the following error when trying to update or create a new object with hibernate: What is really strange is that, sometimes when updating an