-->
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.  [ 5 posts ] 
Author Message
 Post subject: Repeated column in mapping for collection
PostPosted: Tue Aug 02, 2005 7:33 pm 
Beginner
Beginner

Joined: Tue May 31, 2005 1:16 pm
Posts: 35
Location: Bogota, Colombia
I'm getting this error while loading my sessionFactory, I have tried to modify the mapping file unsuccesfully. Wonder if this is a bug. A similar bug appeared to be solved in version 2.0.....

Please help I'm stuck.

Hibernate version:
2.1.8
Mapping documents:
<!-- uni-directional many-to-many association to Programa -->
<set
name="programas"
lazy="true"
cascade="none"
table="convenioprograma_cop"

>

<key>
<column name="ncop_codigoempresa"/>
<column name="ccop_codigoconvenio" />
</key>

<many-to-many
class="co.com.unionsoluciones.sofia.cartera.model.bo.Programa"
>

<column name="ncop_codigoempresa" />
<column name="ccop_codigoprograma" />

</many-to-many>
</set>


Full stack trace of any exception that occurs:
net.sf.hibernate.MappingException: Repeated column in mapping for collection: co.com.unionsoluciones.sofia.cartera.model.bo.Convenio.programas column: ncop_codigoempresa
at net.sf.hibernate.collection.AbstractCollectionPersister.checkColumnDuplication(AbstractCollectionPersister.java:652)
at net.sf.hibernate.collection.AbstractCollectionPersister.<init>(AbstractCollectionPersister.java:163)
at net.sf.hibernate.collection.BasicCollectionPersister.<init>(BasicCollectionPersister.java:36)
at net.sf.hibernate.persister.PersisterFactory.createCollectionPersister(PersisterFactory.java:55)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:147)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:791)
at org.springframework.orm.hibernate.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:544)
at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:479)
at

Name and version of the database you are using:
MS SQL Server 2000

The generated SQL (show_sql=true):
No SQL Involved

_________________
Julian Garcia


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 03, 2005 3:12 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
The message is quite clear : the column ncop_codigoempresa is defined twice in your mapping file. You cannot use the same column for both keys of your many-to-many classes

Seb


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 03, 2005 9:57 am 
Beginner
Beginner

Joined: Tue May 31, 2005 1:16 pm
Posts: 35
Location: Bogota, Colombia
I generated my mapping using middlegen, unfortunately I'm working with a legacy database. The mapping was generated that way, due to the fact that the referenced column belongs to the primary key of an entity that is related to all the entities of the model.

What can I do to solve this problem?

_________________
Julian Garcia


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 03, 2005 10:45 am 
Beginner
Beginner

Joined: Tue May 31, 2005 1:16 pm
Posts: 35
Location: Bogota, Colombia
The problem is that the referenced colum is part of the primary key of both tables. That is the way the legacy database is designed. How can I avoid this.

_________________
Julian Garcia


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 04, 2005 1:29 pm 
Beginner
Beginner

Joined: Tue May 31, 2005 1:16 pm
Posts: 35
Location: Bogota, Colombia
I am still struggling with this problem. Please help.

_________________
Julian Garcia


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