Good point. I've modified the test further to include the session.clear() and also tested with a completely new, never used and cleared session:
...
// 2.
firstSession.clear();
EntityManager secondSession = getOrCreateEntityManager( );
Fruit result2 = firstSession.getReference(Fruit.class, newId);
System.out.println("2.(getReference) result is:" + result2);
firstSession.clear();
secondSession.clear();
Fruit result3 = secondSession.getReference(Fruit.class, newId);
System.out.println("3.(getReference) result is:" + result3);
The results are the same:
2.(getReference) result is:org.hibernate.jpa.test.inheritance.Strawberry@142406db
3.(getReference) result is:org.hibernate.jpa.test.inheritance.Strawberry@7646acf9
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
Good point. I've modified the test further to include the session.clear() and also tested with a completely new, never used and cleared session:
...
// 2.
firstSession.clear();
EntityManager secondSession = getOrCreateEntityManager( );
Fruit result2 = firstSession.getReference(Fruit.class, newId);
System.out.println("2.(getReference) result is:" + result2);
firstSession.clear();
secondSession.clear();
Fruit result3 = secondSession.getReference(Fruit.class, newId);
System.out.println("3.(getReference) result is:" + result3);
The results are the same:
2.(getReference) result is:org.hibernate.jpa.test.inheritance.Strawberry@142406db
3.(getReference) result is:org.hibernate.jpa.test.inheritance.Strawberry@7646acf9