-->
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: join table to a subclassed table with composite FK
PostPosted: Sat Sep 03, 2011 11:40 pm 
Newbie

Joined: Sat Sep 03, 2011 11:20 pm
Posts: 1
Hi,

I am trying to map a join table between a regular table and another table which is being subclassed as given below:

ESignature
*PK ESignatureID :int
* SignerLoginName :nvarchar(250)
* SignatureDate :datetime

DocumentFileStorage ( This is also being used as Collection by another Table Document )
*pfK DocumentID :int
*pfK FileStorageID :uniqueidentifier
*PK Version :int

And join table between ESignature and DocumentFileStorage
ESignatureDocument
*pK ESignatureDocumentID
*pfK ESignatureID :int
*pfK DocumentID :int
*pfK Fil eStorageID :uniqueidentifier
*pfK VersionID :int

I tried so many different ways to map the join table 'ESignatureDocument' but with no success. I am copying the mapping files as given below, which are definitely not correct after many updates:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping schema="dbo">
<class name="gov.nih.bmiss.domain.ESignatureDocument" table="ESignatureDocument">
<id name="eSignatureDocumentID" type="java.lang.Integer">
<column name="ESignatureDocumentID" />
<generator class="native" />
</id>
<many-to-one name="eSignature" class="gov.nih.bmiss.domain.ESignature">
<column name="ESignatureID" not-null="true" />
</many-to-one>
<many-to-one name="documentFileStorage">
<column name="DocumentID" not-null="true"/>
<column name="FileStorageID" not-null="true" />
<column name="Version" not-null="true"/>
</many-to-one>

</class>

</hibernate-mapping>
----------------------------------

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping schema="dbo">

<class name="gov.nih.bmiss.domain.DocumentFileStorage" table="DocumentFileStorage">

<composite-id>
<key-many-to-one name="document" class="gov.nih.bmiss.domain.Document"></key-many-to-one>
<key-many-to-one name="fileStorage" class="gov.nih.bmiss.domain.FileStorage"></key-many-to-one>
<key-property name="version"></key-property>
</composite-id>

</class>
</hibernate-mapping>
-----------------------------------------
Could any one please tell me what is the correct way to map such join tables.

Thanks,
Umesh Kant


Top
 Profile  
 
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.