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.  [ 3 posts ] 
Author Message
 Post subject: "unique" already specified for element "many-
PostPosted: Wed Jul 23, 2008 12:09 pm 
Beginner
Beginner

Joined: Wed Sep 21, 2005 12:02 am
Posts: 31
I am using XDoclet 1.2.3 and Hibernate 3.2. I am currently migrating code from Hibernate 2 to Hibernate 3.2.

Using Ant I generate the .hbm.xml files from my entity classes, using the following:

Code:
      <hibernatedoclet
          destdir="${generated.home}"
          excludedtags="@version,@author,@todo"
          force="${generated.forced}"
          mergedir="${generated.home}"
          verbose="false">
             <fileset dir="${src.home}">
                 <include name="**/entity/**/*.java"/>
             </fileset>
          <hibernate version="3.0"/>
      </hibernatedoclet>


Running this the mapping files are generated without apparent error. The issues arises when I try running my application. What happens is that I get the following error:

Code:
23 juil. 2008 11:41:06,653 DEBUG DTDEntityResolver:38 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
23 juil. 2008 11:41:06,653 DEBUG DTDEntityResolver:40 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
23 juil. 2008 11:41:06,653 DEBUG DTDEntityResolver:50 - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
23 juil. 2008 11:41:06,699 ERROR XMLHelper:61 - Error parsing XML: XML InputStream(61) Attribute "unique" was already specified for element "many-to-one".


Looking through the generated hbm.xml files I do indeed see a "many-to-one" with two "unique" attributes:
Code:
        <many-to-one
            name="company"
            class="com.myco.entity.general.Compagnie"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            unique="true"
            column="idCompany"
            unique="true"
        />


The declaration in my class file , named 'Order.java', is the corresponding method:
Code:
    /**
     * @return Returns the company.
     * @hibernate.many-to-one column="idCompany" unique="true"
     */
    public Company getCompany () {
        return this.company;
    }


Can anyone suggest what is going on? I can't see any unique keyword specified in the Company class?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 23, 2008 12:15 pm 
Beginner
Beginner

Joined: Wed Sep 21, 2005 12:02 am
Posts: 31
Looks like this question was already answered (improving my search terms helped), and this appears to be due to a bug in the tool: http://forum.hibernate.org/viewtopic.php?t=943072

For more detail a line has been introduced that shouldn't hav been into the file:

xdoclet/modules/hibernate/src/xdoclet/modules/hibernate/resources/hibernate-properties.xdt

This mistake is corrected in revision 1.31:

http://xdoclet.cvs.sourceforge.net/xdoc ... f_format=h

Essentially if you are using xdoclet 1.2.3, then you should comment out, or delete, lines 43-45 inclusive.

Version 1.2.3 is the latest binary release (dated 2005-04-16), of XDoclet, at this point, even if the issue has been fixed in CVS since 2005.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 25, 2008 3:39 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Kewl...Thanks for the update!

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


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