Hi all,
I am using JDBC transaction management in my JSF application running on tomcat. I am however wondering how to make sure that all queries are committed (which I think is required?).
For example, I have a JSF detail page to show everything of a project. First I do a get of the project:
Code:
public Project get(String projectId) {
Session session = Manager.getSessionFactory().getCurrentSession();
session.beginTransaction();
Project t = (Project) session.load(Project.class, projectId);
// TODO Check
//session.getTransaction().commit();
return t;
}
As you can see, I don't commit here to not detach the object. JSF will call some getters while rendering my page, and hibernate will equally need to get these lazy properties from the database.
So, as you can see my transaction is never committed.
- Is that a problem?
- How can I best solve this? Is there a way to get an object with all lazy properties so that I could get them all at once and commit immediately after?
Thanks,
Steven