-->
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.  [ 2 posts ] 
Author Message
 Post subject: Many-to-Many relation with properties
PostPosted: Tue Sep 06, 2005 12:03 pm 
Newbie

Joined: Tue Sep 06, 2005 11:56 am
Posts: 1
I have a many-to-many association defined as follows:

Code:
<set name="activationCode2package" table="activation_code2package">
            <key column="activation_code_id"/>
            <composite-element class="ActivationCode2Package">
               <property name="isCrashed" type="boolean" column="is_crashed"/>
              <property name="useDate" type="timestamp" column="use_date"/>
               <many-to-one name="pkg" class="Package" column="package_id"/>
            </composite-element>
        </set>


and

Code:
        <set name="activationCode2package" table="activation_code2package">
            <key column="package_id"/>
            <composite-element class="ActivationCode2Package">
               <property name="isCrashed" type="boolean" column="is_crashed"/>
              <property name="useDate" type="timestamp" column="use_date"/>
               <many-to-one name="activationCode" class="ActivationCode" column="activation_code_id"/>
            </composite-element>
        </set>



Obviously the primary key of the bridge table (package2activation_code) must be "pkg + activation_code"...
But... When I create DB with SchemaExport this table doesn't have primary key!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 5:09 pm 
Beginner
Beginner

Joined: Fri Oct 15, 2004 9:58 pm
Posts: 25
Shouldn't you have a many-to-many element in the mapping if you want to map such a relation? I don't see one in your mapping.
It might be better if you give the whole class and corresponding DDL generated.


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

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.