Pardon me, but
Code:
<hibernate-mapping package="org.foo">
<class name="SuperType" table="SUPER_HIERARCHY" discriminator-value="super">
<id name="id" column="ID" type="long" unsaved-value="0">
<generator class="native" />
</id>
<discriminator column="PAYMENT_TYPE" type="string" />
<subclass name="ChildType" discriminator-value="child" />
</class>
<sql-query name="getAll">
<return alias="x" class="SuperType"></return>
select {x.*} from SUPER_HIERARCHY x
</sql-query>
</hibernate-mapping>
Code:
SuperType s = new SuperType();
ChildType c = new ChildType();
session.save(s);
session.save(c);
List<SuperType> result = session.getNamedQuery("getAll").list();
System.out.println(result);
and output
Code:
Hibernate: insert into SUPER_HIERARCHY (ID, PAYMENT_TYPE) values (null, 'super')
Hibernate: insert into SUPER_HIERARCHY (ID, PAYMENT_TYPE) values (null, 'child')
Hibernate: select x.ID as ID0_0_, x.PAYMENT_TYPE as PAYMENT2_0_0_ from SUPER_HIERARCHY x
[org.foo.SuperType@1dacccc, org.foo.ChildType@d58939]
hibernate version is 3.2.4.sp1, db - h2