Hi,

OpenJPA allows mixing inheritance types in the hierarchy.

Can you try annotating each class with the @Inheritance annotation?

The inheritance strategy for the abstract class should be subclass to avoid having a table for the abstract class.

Craig

On May 7, 2009, at 7:30 AM, Leonardo NOLETO wrote:


Hi,

I have a big problem with TABLE_PER_CLASS mapping...I want map each concrete
classes in my class hierarchy to a separate table (in accordance with
JSR-200 page 39 - Table per Concrete Class Strategy)

When I use OpenJPA as provider, I have the following behavior :

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
abstract class RootClass { // persistent properties}

@Entity
@Table(name="BAR_TABLE")
class Bar extends RootClass {...}

@Entity
abstract AbstractFoo extends RootClass { // extra attributes }

@Entity
@Table(name="FOO1_TABLE")
class Foo1 extends AbstractFoo {...}

@Entity
@Table(name="FOO2_TABLE")
class Foo2 extends AbstractFoo {...}

The image below helps to visualize my problem:

http://n2.nabble.com/file/n2828426/tpc_issue_openjpa2.png

If I use Hibernate as provider this works fine.

Does anyone know why?

I use openjpa-1.2.0.

--
View this message in context: 
http://n2.nabble.com/TABLE_PER_CLASS-does-not-work-as-described-in-JSR-200-%28JPA-1.0%29-tp2828426p2828426.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Craig L Russell
Architect, Sun Java Enterprise System http://db.apache.org/jdo
408 276-5638 mailto:[email protected]
P.S. A good JDO? O, Gasp!

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to