Hi communities
Currently I am reading the book "Java Persistence with Hibernate" but I have a question regarding the persistence context and a detatched object.
I am developing a single user RCP for a friend and first I load all my objects. After that the session is closed. These objects then are used to fill my views and editors. Hibernate is used again when the users whants to save the changes he made in the ui so at this point none of the detatched objects have been modified.
I thought I can do something like this
Code:
session = sessionFactory.openSession();
tx = session.beginnTransaction();
// Vehicles are my Objects
vehicle1.setVin( vinTextField.getText() );
tx.commit();
session.close()
Would vehicle1 be persistent? Or do I have to load this object first (by id), then merge (or update) it and then call my setter-method?
Thx in advance (I hope this was not to confusing)
-- Marc