I've set up some Hibernate transactions and queries to select data from the database, update it, and then save the results back to the database.
However, now I just want to get a list of some of the items in the database. I don't need to make any changes at all. So I don't need to commit or rollback. However, will just running the query leave the transaction open if I don't call commit or rollback?
What's the proper way to query the database if you don't intend to change anything? I couldn't seem to find anything concerning this in the searches I did.
Hello Bai, i don't know if it leaves the transaction open or not, i think that it depends.
It depends on the transaction manager that you are using if any, and if the there it's a
transaction timeout associated with it.
I prefer to always starts and commit a transaction to denote a unit of work. It's a nice
recommendation, 'cause, some of the objects associated with the session can be eligible for GC (if no caching is used).
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com