hibernate-3.2
MySQL 4.1
Code:
Parent parent1 = (Parent) session.load(Parent.class, id);
System.err.println("object is : " + parent1);
if (parent1 instanceof Child)
{
System.err.println("It is a Child!");
}
This does NOT print "It is a Child!" , even if the object is a Child.
It just prints "I'm a Child, ...." (see below).
Defs :
Code:
public class Child extends Parent
{
String foo; // some property
...
public String toString()
{
return "I'm a Child, "+super.toString()+"\n foo:" + foo+ ...;
}
}
Mapping :
Code:
<hibernate-mapping package="com.foo.bar.ix">
<class name="Parent">
<id name="id">
<generator class="native" />
</id>
<property name="foo"/>
<property name="bar"/>
<joined-subclass name="Child">
<key />
<property name="foo"/>
</joined-subclass>
</class>
If I change the first line to
<hibernate-mapping package="com.foo.bar.ix" default-lazy="false"> then it works as expected.
Any idea how to make work with lazy fetching too ?
Regards,
David