-->
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: MappingException: Repeated column...
PostPosted: Mon Aug 30, 2004 10:27 am 
Newbie

Joined: Mon Aug 30, 2004 9:54 am
Posts: 8
I'm trying to set up a class with a lot of sets of dependant classes. An abstract base class defines stuff like the primary ID and other needed functionality, while all the other classes just extend this base class.

So there is
* one abstract base class AC
* one class C which extends AC and holds a number of java.util.Set properties, filled with one of C1, C2, C3
* a number of classes C1, C2, C3 which also extend AC and will only complement C

The relevant Java code looks like this:
Code:
   private Set texte = Collections.EMPTY_SET;

   /**
    * @return Returns the text.
    * @hibernate.set lazy="true"
    *                sort="com.pi.tcomadm.entities.components.Version"
    * @hibernate.collection-key column="tarif_id"
    * @hibernate.collection-one-to-many class="com.pi.tcomadm.entities.TarifText"
    */
   public Set getTexte() {
      return this.texte;
   }

XDoclet happily transforms this into a mapping document for class C that contains Set definitions like this one:
Code:
<set
    name="texte"
    lazy="true"
    inverse="false"
    cascade="none"
    sort="com.pi.tcomadm.entities.components.Version"
>
      <key
          column="tarif_id"
      />

      <one-to-many
          class="com.pi.tcomadm.entities.TarifText"
      />
</set>


Class com.pi.tcomadm.entities.TarifText is one of the classes C1, C2, C3 which extend AC. When I try to start my application, it throws the exception found below. My questions are:

* Is this the preferred "hibernated" way of designing the data?
* What do I have to do in order to avoid that exception?
* Why does Hibernate throw an exception about class [em]TarifartKombination[/em] which isn't even accessed in the given example, and which worked before I started implementing the classes AC, C, C1, C2, C3...?

Any help is greatly appreciated. Best regards,

- Christian

Hibernate version: 2.1.7 built from CVS
Name and version of the database you are using: mySQL 4.0.18 w/ mySQL JDBC Driver 3.0 (production)
Full stack trace of any exception that occurs:
Code:
net.sf.hibernate.MappingException: Repeated column in mapping for class com.pi.tcomadm.entities.TarifartKombination should be mapped with insert="false" update="false": id
   at net.sf.hibernate.persister.AbstractEntityPersister.checkColumnDuplication(AbstractEntityPersister.java:1015)
   at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:819)
   at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:42)
   at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:136)
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:792)
   at com.pi.portal.tools.Setup.run(Setup.java:43)
   at com.pi.portal.tools.Setup.main(Setup.java:32)


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.