These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]

Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Mapping where joined-subclass has its own primary key
PostPosted: Tue Mar 01, 2005 10:24 am 

Joined: Fri Feb 13, 2004 10:02 pm
Posts: 90
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
DB2 UDB 8.2
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:

Hi all,
I have a question about mapping and I cannot find a good answer to it. I have the following business object structure.


Application extends Document

Application has many ApplicationEntityRoles

In the database I have the following foreign keys

Document --> Primary Key = DocumentID

Application --> Primary Key = ApplicationID. Foreign Key = DocumentID

ApplicationEntityRole --> PrimaryKey = ApplicationEntityRoleID. ForeignKey = ApplicationID.

Now, I have the following mapping.

<hibernate-mapping package="com.llic.business">
   <class name="Document" table="DOCUMENT">
         <generator class="native" />

            <joined-subclass name="Application" table="APPLICATION" extends="Document">
   <!--   <id
         <generator class="native" />
      <key column="DOCUMENTID"/>


My question is the following. Is there any way to map the applicationId in hibernate so that it is automatically generated by the identity in DB2? It is needed since the foreign key to ApplicationID is contained within ApplicationEntityRole. I can't change our Schema, since it needs to remain compatible with legacy appliations. Any help would be greatly appreciated.


Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.