Hi!
I have this with hibernate 3.2.0.cr2 (inside JBoss 4.0.4GA):
Code:
Mapped m = session.get(Mapped.class,myID);
session.flush();
session.evict(m);
session.flush();
// ...
session.get(m.getClass,m.getID());
This runs once, and then again (the value of myID is the same).
On the second run, the get(Mapped.class,myID) returns an object of type Mapped$$EnhancerByCGLIB$$f6f2dbd7 instead of Mapped, so the line session.get(m.getClass,m.getID()); fails as it will try to load an object of type Mapped$$EnhancerByCGLIB$$f6f2dbd7 , but that has no defined mapping.
I get :
Code:
Caused by: org.hibernate.MappingException: Unknown entity: Mapped$$EnhancerByCGLIB$$f6f2dbd7
Why does it return in the second case this weird object (I guess it is a proxy) instead of a normal object, like in the first iteration (it is basically a loop).
How do I force it return a plain object ?
The book "Hibernate in Action" says in 4.4.1 "Retrieving objects by identifier" it:
get() never returns a proxy.
But in my case it does ???
Regards,
David