Hibernate 2.1.6
Hi, I have a class A which is persistent (eg, entered in an hbm.xml file). I have a class B which is subclass of A, but is not persistent (not in an hbm.xml file). Can I load the state of an instance of A into an instance of B?
I'm trying to do
Code:
B b = new B();
Serializable aId = // ID of a persistent instance of A.
session.load(b, aId);
but of course I get
net.sf.hibernate.MappingException: No persister for: B
So, I'm looking for something that would work like session.load(Object, Serializable), but would maybe also take the persistent class of the object to load, like
Quote:
session.load(Class cls, Object o, Serializable id)
which would work provided o is a subclass of cls. Does this functionality exist?
Thanks.