Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
im trying to map a many-to-many relationship between the tables LOY_ORDINE and LOY_BOLLA using the join-table LOY_BOLLA_ORDINE: the fact is that there is a field in the join table which is foreign key to both tables and my mapping (which IS correct accordind to the doc .. yes i read it) reflects the thing ..
why is not working???
Repeated column in mapping for collection: fuckthegest.model.Ordine.bolle column: C_CMP
but C_CMP is foreing key both to LOY_ORDINE and LOY_BOLLA so i HAVE to put it both in <key> and <many-to-many> inside <set name="bolle">
Hibernate version:
2.1
Mapping documents:
<hibernate-mapping>
<class name="fuckthegest.model.Ordine" table="LOY_ORDINE">
<composite-id>
<key-property name="cmp" type="string" column="C_CMP" />
<key-property name="codOrd" type="string" column="C_COD_ORD" />
<key-property name="datOrd" type="date" column="D_DAT_ORD" />
</composite-id>
<property name="stato" type="string" column="C_STA_ORD" />
<set name="bolle" table="LOY_BOLLA_ORDINE" >
<key>
<column name="C_CMP" />
<column name="C_COD_ORD" />
<column name="D_DAT_ORD" />
</key>
<many-to-many class="fuckthegest.model.Bolla" >
<column name="C_CMP" />
<column name="C_COD_BOL" />
<column name="D_DAT_BOL" />
</many-to-many>
</set>
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="fuckthegest.model.Bolla" table="LOY_BOLLA">
<composite-id>
<key-property name="cmp" type="string" column="C_CMP" />
<key-property name="codBolla" type="string" column="C_COD_BOL" />
<key-property name="datBolla" type="date" column="D_DAT_BOL" />
</composite-id>
<property name="stato" type="string" column="C_STA_BOL" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
net.sf.hibernate.MappingException: Repeated column in mapping for collection: fuckthegest.model.Ordine.bolle column: C_CMP
at net.sf.hibernate.collection.AbstractCollectionPersister.checkColumnDuplication(AbstractCollectionPersister.java:654)
at net.sf.hibernate.collection.AbstractCollectionPersister.<init>(AbstractCollectionPersister.java:167)
at net.sf.hibernate.collection.BasicCollectionPersister.<init>(BasicCollectionPersister.java:35)
at net.sf.hibernate.persister.PersisterFactory.createCollectionPersister(PersisterFactory.java:55)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:148)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:805)
at fuckthegest.model.manager.ManagePropostaOrdine.select(ManagePropostaOrdine.java:26)
at fuckthegest.web.po.PoSelectAction.execute(PoSelectAction.java:46)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)