-->
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.  [ 8 posts ] 
Author Message
 Post subject: Repeated column in mapping for collection
PostPosted: Wed Feb 04, 2004 3:31 pm 
Newbie

Joined: Wed Feb 04, 2004 3:22 pm
Posts: 7
Location: Argentina
I have this tables structure (i can't change it):

Apl
---
apl_id pk
name
usr

rol
---
apl_id fk,pk
rol_id pk

entity
------
apl_id fk,pk
en_id pk

rol_entity
----------
apl_id fk,pk
en_id fk,pk
rol_id fk,pk

I defined this mappings :

<class name="xxx.Apl" table="APL">
<id name="id" type="integer">
<column name="APL_ID"/>
...
</id>
...
</class>

<class name="xxx.Rol" table="ROL">
<composite-id name="id">
<key-property name="rolid">
<column name="ROL_ID"/>
</key-property>
<key-many-to-one name="apl">
<column name="APL_ID"/>
</key-many-to-one>
</composite-id>
<set name="entities"
table="ROL_ENTITY"
lazy="true"
cascade="all-delete-orphan">
<key>
<column name="ROL_ID"/>
<column name="APL_ID"/>
</key>
<many-to-many class="xxx.Entity">
<column name="APL_ID"/>
<column name="EN_ID"/>
</many-to-many>
</set>
...
</class>
<class name="xxx.Entity" table="ENTITY">
<composite-id name="id">
<key-property name="enid">
<column name="EN_ID"/>
</key-property>
<key-many-to-one name="aplid">
<column name="APL_ID"/>
</key-many-to-one>
</composite-id>
...
</class>

When i build the session factory, i obtain this error :

INFO: building session factory
net.sf.hibernate.MappingException: Repeated column in mapping for collection: ar.com.arcor.esecurity.beans.Entidad.roles column: APL_ID
at net.sf.hibernate.collection.AbstractCollectionPersister.checkColumnDuplication(AbstractCollectionPersister.java:666)
at net.sf.hibernate.collection.AbstractCollectionPersister.<init>(AbstractCollectionPersister.java:163)
at net.sf.hibernate.collection.BasicCollectionPersister.<init>(BasicCollectionPersister.java:35)
...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 3:41 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
APL_ID is in both a key-many-to-one and a many-to-many.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 6:28 pm 
Newbie

Joined: Wed Feb 04, 2004 3:22 pm
Posts: 7
Location: Argentina
greg_barton wrote:
APL_ID is in both a key-many-to-one and a many-to-many.

yes, this is ok, because APL_ID is key in the table ROL, and APL_ID is a foreign key to Application . And the relation between ENTITY and ROL is with APL_ID and ENT_ID (is a many-to-many relation) ...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 6:35 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
OK for the data model, but not for hibernate: http://forum.hibernate.org/viewtopic.php?t=925446


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 8:28 pm 
Newbie

Joined: Wed Feb 04, 2004 3:22 pm
Posts: 7
Location: Argentina
so ? any idea ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 9:04 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
Well, I haven't posted this to JIRA as a feature request because of Gavin's initial response. However, you're the third poster besides myself who has travelled close to this idea, so I think I'll submit it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 9:33 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
The trouble is really that this is not -at-all- easy to implement and would require complete redesign of Type hierarchy.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 05, 2004 1:14 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
OK. :)

3.0? :P


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.