Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Annotations - InheritanceType.TABLE_PER_CLASS doesn't seem to work with GF

433495Jan 29 2007 — edited Dec 20 2007
Hi there,

I'm using the toplink essentials jar file with a stand alone J2SE application. I'm using annotations for ORM with Toplink implementation

What I want to achieve is to map the base class objects to one table, and sub class objects to a different table. Currently - both tables (and objects) have the exact same structure, but I use inheritence in order to identify where should the object be registered. Thus I'm trying to map an inhertiance using TABLE_PER_CLASS type.

It doesn't seem to work:

My classes look like this:

Base class I want to map to REGION table:
---------------------------------------------------------------

@Entity
@Table(name="REGION")
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public class Region implements BaseBusinessObj
{
@Id
@Column(name = "REGION_ID", insertable = false, updatable = true)
@GeneratedValue(generator = "regionSeq")
@SequenceGenerator(name = "regionSeq",
sequenceName = "GSM_REGION_ID_SEQ", allocationSize = 1)
private int m_regionId;

@Column(name = "REGION_NAME")
private String m_regionName;
}

Subclass with exact same structure I want to map to GFR_REGION table which has the exact same database table structure as REGION:
-------------------------------------------------------------------------------------------------------------------

@Entity
@Table(name="GFR_REGION")
public class GfrRegion extends Region
{
}

This doesn't work. The Toplink adds entities of the GfrRegion to the REGION table and does not recognize it should go to the GFR_REGION table.

What am I doing wrong?

Thanks,
Michael
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 17 2008
Added on Jan 29 2007
4 comments
2,405 views