Is it true that hibernate (2.1.2) uses 1 connection per Session and never releases it even if it does not need it. Would not it be much more efficient to request/release connection on-demand - when it is needed for DB access?
Otherwise it is problem for long running transactions.
For example:
1. I am loading Person data in session1 (connection gets associated with session1)
2. Person data is displayed in webform, where user modifies it and sends back to server.
3. I am starting transaction for session1, populating data and doing session1.update(person1). and doing commit for that transaction
4. closing session1 (connection gets released)
once number of users who have opened this form or any other form for update will exceed number of connections allowed I will start geting Exceptions.
Also I can not really load data in one Session and save it in another, because objects graphs are pretty complex and I would like to track changes and save only changed objects (using cascade).
What are your suggestions folks?
Rihards
|