Forums Register Login

Without marking transaction demarcation, just loading an entity through session

+Pie Number of slices to send: Send
What happens if I load an entity saying session.load() and close the session without beginning a transaction & comitting it
I gone through various sites, but couldn't find any good explanation.

1
+Pie Number of slices to send: Send
If i understood your question correctly, you want to know the effect of reading an entity without having any transaction. If so, then there is no adverse effect. Transactions are supposed to be used where you are making any kind of change in the database (like insert/update/delete operations). Just to read an Entity, transaction should not be used.
+Pie Number of slices to send: Send
Thanks for reply.

In the following post it says, if we access an entity in non-transactional way, we need to enable auto-commit in hibernate configuration.
If not, once we close the session (we used for retrieving the entity) the database connection returning to the pool will have some issues/memory leaks.

https://community.jboss.org/wiki/OpenSessionInView

lines in this link "the connection is in whatever mode it is by default after obtained from the pool, and returned there without commit or rollback. The behavior is then undefined."

kindly make me clear here.
Every plan is a little cooler if you have a blimp. And a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 725 times.
Similar Threads
Persitence confusion. Please help.
Transaction question for attribute "Not Supported"
Transaction-propagation
Passing Session Bean References in Remote Calls
How to obtain entity manager in application server?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:59:10.