Hibernate version:
3
Mapping documents:
NA
Code between sessionFactory.openSession() and session.close():
NA
Full stack trace of any exception that occurs:
NA
Name and version of the database you are using:
NA
The generated SQL (show_sql=true):
NA
Debug level Hibernate log excerpt:
NA
The example below is not very clear. With Hibernate this seems straight foward because of it use of disconnected entites and the session being closed/opened on every request. With JPDA, how would one handle the fact that within an extended session (conversation) that may never make to the point where em.close() is called? An example would be a wizard where there are 3 steps ... (1) the entity manager is set (2) the user updates some entities (3) the user never clicks to finalize the changes. So if the user never finalizes the changes then em.close() is never called what happens then?
Code:
// Begin persistence context and conversation
EntityManager em = emf.createEntityManager();
ManageAuctionExtended controller = new ManageAuctionExtended(em);
// First event
Item item = controller.getAuction( 1234l );
// Item is displayed on screen and modified...
item.setDescription("[SOLD] An item for sale");
// Second event
controller.endAuction(item);
// End persistence context and conversation
em.close();