Home > other >  Java - and Hibernate read-only database connection
Java - and Hibernate read-only database connection

Time:11-17

Whether can use Hibernate and use read-only connection to connect to the database? I will study a project, the project needs to connect to an existing database, extract data, and in the application to perform some complex data manipulation. In all of these, I can't change any content in the database, so the read-only connection requirements.
My first idea is to use Hibernate to extract data from the database, so I can let the ready-made Java object represents data, however, I can't seem to find about how to use read-only database connection mandatory Hibernate any information... I have a feeling that this may actually be impossible, but I want to looking for other ideas from others before you find the answer.

CodePudding user response:

I don't have enough reputation comments, clearly: (
But to respond to you about the Hibernate may still write back to the database of comments, you can manually to isolate the object from the persistence context, Hibernate will cease to pay attention to the state of an object after & amp; If modified.

CodePudding user response:

The problem solved? I now also is the case
  • Related