This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello, there Ranch folks! I'm facing a problem with multi-level inheritance in Hibernate, mixing inheritance strategies. I have not found any examples or solutions to this particular problem on the web, so let me try to describe it:
In other words: C and D extend B while E and B extend A. Classes B and A are abstract.
My database is set this way: I have a table named "table_A", a table named "table_B" and a table named "table_E".
I'm using Java 5 with Hibernate 3.2.1 (with Annotations 3.2.0). The mapping looks like this:
The real problem happens when I'm trying to query for a list of entities of type A. Looks like Hibernate is not trying to instantiate C and D by the single table strategy. Hibernate is trying to resolve C and D using the InheritanceType.JOINED strategy, looking for tables with names "C" and "D", since the name of the table is not specified. Apparently Hibernate is ignoring the second strategy (InheritanceType.SINGLE_TABLE). I read somewhere (hard to find out where, after so many searches) that Hibernate can handle mixing strategies in this multi-level inheritance problem. What am I doing wrong? [ January 11, 2008: Message edited by: Marco Tulio Borges ]
.: SCJP 1.4 (95%) / SCWCD 1.4 (91%) / SCBCD (77%) :.
"Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us." - Calvin