Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
2.1.8
Mapping documents:
NONE
Code between sessionFactory.openSession() and session.close():
NONE
Full stack trace of any exception that occurs:
NONE
Name and version of the database you are using:
DB2 UDB 8.2
The generated SQL (show_sql=true):
NONE
Debug level Hibernate log excerpt:
NONE
Hi all,
I have a question about mapping and I cannot find a good answer to it. I have the following business object structure.
Document
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.
Code:
<hibernate-mapping package="com.llic.business">
<class name="Document" table="DOCUMENT">
<id
column="DOCUMENTID"
name="id"
type="java.lang.Long"
>
<generator class="native" />
</id>
.....
<joined-subclass name="Application" table="APPLICATION" extends="Document">
<!-- <id
column="APPLICATIONID"
name="id"
type="java.lang.Long"
>
<generator class="native" />
</id>-->
<key column="DOCUMENTID"/>
...
</joined-subclass>
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.
Thanks,
Todd