-->
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: Repeated column in a composite-id
PostPosted: Fri Jun 10, 2005 12:13 am 
Newbie

Joined: Thu Jun 09, 2005 11:48 pm
Posts: 1
I have an object that resolves a relationship many-to-many between
objects whose keys are composite-ids. Did anyone have a similar problem? Or is there a better way to do this?

Thanks

Hibernate version:
Hibernate 3.0 beta4

Mapping documents:
<hibernate-mapping>
<class name="beans.CPDTypeWeightTO" table="new2CpdTypeWeight">
<composite-id>
<key-many-to-one name="cpdType" class="beans.RefCPDTypeTO">
<column name="cpdProgramId"/>
<column name="cpdTypeId"/>
</key-many-to-one>
<key-many-to-one name="weightFactor" class="beans.RefCPDWeightFactorTO">
<column name="cpdProgramId"/>
<column name="weightFactorId"/>
</key-many-to-one>
</composite-id>

<many-to-one name="cpdType" class="beans.RefCPDTypeTO" insert="false" update="false" fetch="join">
<column name="cpdProgramId"/>
<column name="cpdTypeId"/>
</many-to-one>

<many-to-one name="weightFactor" class="beans.RefCPDWeightFactorTO" insert="false" update="false" fetch="join">
<column name="cpdProgramId"/>
<column name="weightFactorId"/>
</many-to-one>

<property name="cancelled" column="cancelled" type="char"/>
<property name="dateCreated" column="dateCreated" type="timestamp"/>
<property name="createdBy" column="createdBy" type="string"/>
<property name="lastUpdated" column="lastUpdated" type="timestamp"/>
<property name="updatedBy" column="updatedBy" type="string"/>
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
I am still creating the sessionFactory when I get this error.

Full stack trace of any exception that occurs:
[2005-06-10 13:44:10,390] [tcpConnection-8080-0] ERROR utils.HibernateUtils - Initial SessionFactory creation failed.
org.hibernate.MappingException: Repeated column in mapping for entity: beans.CPDTypeWeightTO column: cpdProgramId (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:487)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:519)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:318)
at org.hibernate.mapping.RootClass.validate(RootClass.java:186)
at org.hibernate.cfg.Configuration.validate(Configuration.java:814)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1037)
at utils.HibernateUtils.<clinit>(Unknown Source)
at websteps.customer.dao.hibernate.HibCpgCustomerDAO.readCpgCustomer(Unknown Source)
at websteps.customer.Customer.readCustomer(Unknown Source)
at websteps.security.Security.processLogin(Unknown Source)
at actions.SecurityActions.login(Unknown Source)
at actions.SecurityActions.abstractExecute(Unknown Source)
at actions.AbstractAction.execute(Unknown Source)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:165)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)
at utils.CustomFilter.doFilter(Unknown Source)
at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:164)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:479)


Name and version of the database you are using:
Sybase 12.5

The generated SQL (show_sql=true):


Debug level Hibernate log excerpt:


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.