Hi,
I am using hibernate in standalone mode (i.e. not using an app server or container).
I was trying to investigate if hibernate does anything special for object references to persistence POJOs.
More specifically:
there is a persistent POJO called Person, my first persistent reference to this is called person1.
Another thread, runs a query with the primary key for this person and the result is the person2 reference.
Now, in some cases hibernate is smart enough to update person2 to be pointing at the same memory address as person1.
This seems to be when both threads use the same EntityManager reference.
But in other cases, if the thread use different EntityManager references, hibernate will do no smart updated, so each thread's object reference will point to a different memory address, even though it is the same POJO.
I have discovered this by some debugging etc, just want to make sure I am correct?
It appears that hibernate cache's the POJO entity per entity manager,is there any restriction / limitations to this cache.
Cheers
|