Aeh... I was relying on Spring doing the right thing?! (10 extra points
to Lutz ;-) )
I figured since everybody has problems with Spring closing sessions too
early and thereby causing problems with lazy-load, it should not affect
me in this case and actually work for me.
But maybe not???
I honestly have to say I'm not sure how Spring's HibernateTemplate
handles this in detail...
The more I think about it the closer I get to calling myself a Moron... :-)
Ok... here is the deal:
The Page gets the Service (a singleton SpringBean) via tapestry-spring
library ("spring:...").
The Service gets a DAO through Spring IoC.
The DAO gets a SessionFactory via Spring IoC.
The DAO uses getHibernateTemplate() to do the Hibernate-specific stuff.
So I guess the DAO is a singleton that opens a session once and never
closes it? Does that mean that everything is one session/transaction,
across all requests and user-web-sessions?
There is no code at all in the DAO that deals with sessions or
transactions. So if Spring doesn't do it, then nothing does.
I just tried to add a flush to my DAO.save() method, but that does not
change anything either:
public save(Room room) {
getHibernateTemplate().saveOrUpdate(room);
getHibernateTemplate().flush();
}
I implemented my DAO according to the examples in the Spring reference
PDF, but I just noticed that all the examples in there are
read-operations, no inserts/updates/saves.
I think it's time to dig through a bunch of those Spring books - I
should have probably done that earlier.
MARK
Henri Dupre wrote:
On 5/24/06, Mark <[EMAIL PROTECTED]> wrote:
Is there a way to set this in the hibernate.properties?
Right now I do not use OpenSessionInViewFilter...
Oops I should have read the whole thread before answering ;-)
So how do you manage your sessions?
Thanks,
Henri.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]