I have a sample with entity inheritance (by the way: just a sample to show inheritance, nothing which makes sense ;-) ): one base class (ZutatBaseInheritanceBean with generated id and one field), three child classes (ZutatGewichtInheritanceBean, ZutatFluessigkeitInheritanceBean, ZutatStueckzahlInheritanceBean).
I want to make it running in all three inheritance strategies. SINGLE_TABLE und JOINED work fine. But for TABLE_PER_CLASS, it fails to populate a collection of all entities. The first type (ZutatGewichtInheritanceBean) is properly initialized, the other two types just contain the base class fields, all their individual fields are empty.
The named query to load all types of child entities is:
@NamedQuery (name="findAllZutaten", query="select o from ZutatBaseInheritanceBean o")
This seems to be a matter of the SQL statement which I see in the console:
select zutatbasei0_.id as id113_, zutatbasei0_.kuchen_id as kuchen3_113_, zutatbasei0_.zutatName as zutatName113_, zutatbasei0_.gewicht as gewicht114_, zutatbasei0_.gewichtEinheit as gewichtE2_114_, zutatbasei0_.masseinheit as masseinh1_115_, zutatbasei0_.masseinheitMenge as masseinh2_115_, zutatbasei0_.anzahl as anzahl116_, zutatbasei0_.clazz_ as clazz_ from ( select id, gewicht, zutatName, null as anzahl, kuchen_id, null as masseinheit, gewichtEinheit, null as masseinheitMenge, 1 as clazz_ from ZutatGewichtInheritanceBean union select id, null as gewicht, zutatName, null as anzahl, kuchen_id, masseinheit, null as gewichtEinheit, masseinheitMenge, 2 as clazz_ from ZutatFluessigkeitInheritanceBean union select id, null as gewicht, zutatName, anzahl, kuchen_id, null as masseinheit, null as gewichtEinheit, null as masseinheitMenge, 3 as clazz_ from ZutatStueckzahlInheritanceBean ) zutatbasei0_
The columns from ZutatFluessigkeitInheritanceBean and ZutatStueckzahlInheritanceBean are always NULL, so I suspect that either Hypersonic does not support it or the EntityManager creates a wrong query.
I have a "working" sample at http://www.informatik.fh-wiesbaden.de/~knauf/KomponentenArchitekturen2008/kuchenzutatinheritance/KuchenZutatInheritance.ear, but it is completely in german, and the app client is a bit difficult to start (uses EJB injection), so I hope someone can make sense of my descriptions ;-).
I had a similar sample with two child classes, which worked in JBoss 4.2. If I find the time, I will test it with JBoss 5.