-->
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: Many to many mapping question
PostPosted: Wed Dec 29, 2004 5:48 am 
Regular
Regular

Joined: Thu Nov 20, 2003 10:04 pm
Posts: 64
Location: Melbourne, Australia
Hibernate version:

2.x

Mapping documents:

Currently I have a mapping file that looks like this:

Code:
<class
    name="com.avalon.seaview.domain.Content"
    table="SVD_SEAVIEWCONTENT"
    lazy="true"
>
     ...

    <set name="userPermissions" table="SVD_USERPERMISSION" lazy="true">
        <cache usage="read-write"/>
        <key column="ContentId"/>
        <many-to-many class="com.avalon.seaview.domain.Permission" column="PermissionId"/>
    </set>

    <set name="groupPermissions" table="SVD_GROUPPERMISSION" lazy="true">
        <cache usage="read-write"/>
        <key column="ContentId"/>
        <many-to-many class="com.avalon.seaview.domain.Permission" column="PermissionId"/>
    </set>
    ...
</class>


What I would like to do is reduce the many-to-many mappings to use one table instead of two. It seems that I might be able to add a column and use a where attribute to restrict the fetch but how would I set the correct value into the table when inserting (without having to declare a new class to manage the relationship)?

Code between sessionFactory.openSession() and session.close():

n/a

Full stack trace of any exception that occurs:

n/a

Name and version of the database you are using:

n/a

The generated SQL (show_sql=true):

n/a

Debug level Hibernate log excerpt:

n/a


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.