The book Hibernate Java Persistence contains a little mistake:
Section 13.1.3 mentions that Session.get() always hit the database which isn't true, like correctly mentioned in the 3.3.1.GA api doc's.
That is, like I experience myself, the Session.get() can return a proxy if the instance was already loaded as proxy.
This happens when for example the entity in the get was previous already retrieved as proxy during a many-to-one mapping, and stored in the hibernate proxy cache. Hibernate will also perform a proxy-narrow operation if needed.
Cheers,
Ed
|