We have a web app runing in tomcat. When we reload app the session is persisted by tomcat. In the session we keep an instance of the currently logged on employee which is also an entity.
Normally if we go through the sequence
Code:
Customer c = new Customer();
c.setEmployee(employee); <---- from session
session.save(customer)
we get a new entry in our customers table with employee_id set correctly.
However, after a reload if we do the same thing, the employee_id is null.
Going through the code we find that the employee field is nullified in the method nullifyTransientReferences(). if the employee logoffs and logs on again evrything work ok.
can someone please explain what is happening here and if there is a way we can reuse the employee instance.
thanks