Yes, the Spring HibernateTemplate will take care of that for you. The actual behaviour depends on your transaction management, but let's not get into that for now.
So, the save you call will commit the changes to the database. Hibernate then disconnects the session, I believe, anyhow, there is no need for you to add extra code. Since you even flush your session, there is no doubt Hibernate will try to store your object in the database. Even if it doesn't work, you should get some exception. So... - have you checked the rest of your code? Are you sure this piece of code is actually called? Step through it or add debugging output. - if you're sure your application is otherwise correct, the code gets executed with the room object you intend it to, and you still don't have anything in your database, I believe you have something severely misconfigured and suggest you post your configuration. That would be the part of your Spring applicationContext.xml (or whatever it is called in your case) where you set up the data source and the session factory. some more comments...
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???
Since you have no problem with lazy loading, in fact, you are not even loading, I believe keeping the session open until the view is rendered will not help you.
The Page gets the Service (a singleton SpringBean) via tapestry-spring library ("spring:..."). The Service gets a DAO through Spring IoC.
Just out of curiosity: Why do you not inject your Dao into the page? What does "the Service"? do?
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?
No. hth, Lutz --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]