Hi unrealdummy,
About your concern
Quote:
Does that mean that a transient object can also, by accident, be a detached object? (Like for instance, you created a new object and assigned manually its properties and ID that coincidentally represents a row in the database.)
Yes hibernate will treat a
transient object as
detached object if -
1. you assigned a value to identifier property of the object AND
2. Hibernate could not able to fine the object in persistence context AND
2. In the mapping of that class, you gave responsibility to Hibernate (by using sequence, increment etc.) to assign identifier property to object.
About -
Quote:
What is the new state of a persistent object when the transaction is committed BUT the session hasn't closed yet? (after calling tx.commit() and before calling mySession.close() )
this will be the Persistence state of object.
About -
Quote:
What is the new state of a persistent object after the transaction is committed AND the session has closed? (after calling tx.commit() and after calling mySession.close() )
This will be the Detached state of Object.
For more information read thoroughly chapter 9 of
Quote:
JAVA Persistence With Hibernate.
.