And how do you make sure that the hibernate connection is ever closed? You can't count on another http request, since it may never come. Will you put a hook on session expiration?

-Matej

[EMAIL PROTECTED] wrote:
just curious what does this mean:


"All I need is to be able to disconnect the hibernate session after
arequest (that's easy) but more importantly reconnect the
*according*hibernate session before my code is triggered in one of my
components"

what is a disconnected hibernate session? And to what do you reconnect
again?
Where is that session and what does it exactly do? Hold on a database
connection?? Or is the transaction purely in mem?

johan


Yes, a disconnected hibernate session is an in-memory transactional state. On 
disconnection the database connection is released, on reconnection the session 
will aquire a new database connection from the original connection pool.

A Hibernate application transaction is a very convenient programming model:
In most web application you're gathering input from the user across several 
requests. You keep all data in memory, only flushing it to the database after a 
final step (e.g. 'book order').
Normally this requires you to do the following housekeeping in each request:
1) get a new Hibernate session first (can be automated)
2) attach all transactional data with the Hibernate session
3) load new data into memory (through queries or lazy references)
4) change data in memory
5) close Hibernate session (can be automated too)

Note that the point 2) is not trivial to do. Your Wicket models might have 
references to many objects originally loaded from Hibernate. How do you ensure 
that all these objects are re-attached to the new Hibernate session?

If you use disconnected Hibernate sessions, 1) and 5) change to reconnection 
and disconnection respectively, and 2) is furthermore obsolete.
AFAIK these so called 'application transaction' are seldom used, but repeatedly 
recommended by Gavin King.

Sven


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to