jhouse wrote:
If I have a class "org.foo.Foo" and I map it with Hibernate, but then enhance it at runtime, the object instances are of a type such as "org.foo.Foo$$EnhancedByCGLIB$$0" - which extends "org.foo.Foo".
Is there a way to make Hibernate go ahead and persist (save()) this object (i.e. get Hibernate to see that it doesn't have a mapping for a "com.partnet.rex.Foo$$EnhancedByCGLIB$$0" , but realize that it does have a mapping for its parent class, so go ahead and use that mapping).
Likewise for load(), can I pass it an object of type "com.partnet.rex.Foo$$EnhancedByCGLIB$$0" and a key value, and ask it to populate it?
Those CGLIB classes are just subclasses of the original class. Hibernate should/will treat them the same way it would treat any subclass...that said, I'm not sure what the actual behavior is regarding passing in subclassed objects--have you tried it?
Chris