Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:2.0 
Mapping documents:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
>
    <class
        name="za.co.introspect.portal.Person"
        lazy="true"
    >
        <id
            name="id"
            column="person_id"
            type="java.lang.Long"
            unsaved-value="null"
        >
            <generator class="native">
              <!--  
                  To add non XDoclet generator parameters, create a file named 
                  hibernate-generator-params-Person.xml 
                  containing the additional parameters and place it in your merge dir. 
              --> 
            </generator>
        </id>
        <property
            name="registeredStatus"
            type="java.lang.String"
            update="true"
            insert="true"
            column="registeredStatus"
        />
        <property
            name="termsAndConditions"
            type="java.lang.String"
            update="true"
            insert="true"
            column="terms_and_conditions"
            length="10"
        />
        <property
            name="ebppUser"
            type="java.lang.String"
            update="true"
            insert="true"
            column="ebppUser"
        />
        <many-to-one
            name="demographics"
            class="za.co.introspect.portal.Demographics"
            cascade="all"
            outer-join="auto"
            update="true"
            insert="true"
            column="Demographics_id"
        />
        <property
            name="activationKey"
            type="java.lang.String"
            update="true"
            insert="true"
            column="activationKey"
            length="50"
        />
        <property
            name="associationFailures"
            type="java.lang.Long"
            update="true"
            insert="true"
            column="associationFailures"
        />
        <property
            name="countyOfOrigin"
            type="java.lang.String"
            update="true"
            insert="true"
            column="countyOfOrigin"
        />
        <property
            name="firstName"
            type="java.lang.String"
            update="true"
            insert="true"
            column="firstName"
            length="100"
        />
        <property
            name="lastName"
            type="java.lang.String"
            update="true"
            insert="true"
            column="lastName"
            length="100"
        />
        <property
            name="loginFailues"
            type="java.lang.Long"
            update="true"
            insert="true"
            column="loginFailues"
        />
        <property
            name="useCaseID"
            type="java.lang.String"
            update="true"
            insert="true"
            column="useCaseID"
        />
        <property
            name="userID"
            type="java.lang.String"
            update="true"
            insert="true"
            column="userID"
        />
        <property
            name="newUserID"
            type="java.lang.String"
            update="true"
            insert="true"
            column="newUserID"
        />
        <property
            name="registerApplication"
            type="java.lang.String"
            update="true"
            insert="true"
            column="registerApplication"
        />
        <property
            name="title"
            type="java.lang.String"
            update="true"
            insert="true"
            column="title"
        />
        <property
            name="personRefreshTimeStamp"
            type="java.util.Date"
            update="true"
            insert="true"
            column="personRefreshTimeStamp"
        />
        <property
            name="active"
            type="boolean"
            update="true"
            insert="true"
            column="isactive"
        />
        <property
            name="idNumber"
            type="java.lang.String"
            update="true"
            insert="true"
            column="idnumber"
        />
        <property
            name="webUserKey"
            type="java.lang.String"
            update="true"
            insert="true"
            column="webuserkey"
        />
        <many-to-one
            name="contactDetails"
            class="za.co.introspect.portal.ContactDetails"
            cascade="save-update"
            outer-join="auto"
            update="true"
            insert="true"
            unique="true"
            column="contactdetails_id"
            not-null="false"
            unique="true"
        />
        <property
            name="idType"
            type="java.lang.String"
            update="true"
            insert="true"
            column="idType"
            length="40"
        />
        <property
            name="clarifyContactKeyAudit"
            type="java.lang.String"
            update="true"
            insert="true"
            column="clarifyContactKeyAudit"
            length="40"
        />
        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Person.xml
            containing the additional properties and place it in your merge dir.
        -->
    </class>
</hibernate-mapping>
The mapping file above(called Person.hbm.xml) is being generated by xdoclet.When I deploy my application I get a MappingException saying :
Quote:
nested exception is net.sf.hibernate.MappingException:
  org.dom4j.DocumentException: Error on line 198 of document  : <Line 198, Column 11>: XML-20124: (Fatal Error) An attribute cannot appear
  more than once in the same start tag. Nested exception: <Line 198, Column 11>: XML-20124: (Fatal Error) An attribute cannot appear more
  than once in the same start tag.	
net.sf.hibernate.MappingException: org.dom4j.DocumentException: Error on line 198 of document  : <Line 198, Column 11>: XML-20124: (Fatal
Validating the Person.hbm.xml file using XML Spy also gave me an error along the same lines , saying : 
Quote:
The element already has an attribute named 'unique'.
Error location: hibernate-mapping / class / many-to-one / @unique
Details :WFC: Unique Att Spec: The element already has an attribute named 'unique'.
The offending section being :
Code:
<many-to-one
            name="contactDetails"
            class="za.co.introspect.portal.ContactDetails"
            cascade="save-update"
            outer-join="auto"
            update="true"
            insert="true"
            [b]unique="true"[/b]
            column="contactdetails_id"
            not-null="false"
           [b] unique="true"[/b]
        />
The mapping is declared in the code as :
Code:
/**
     * @return the contact details linked to the person
     * @hibernate.many-to-one class="za.co.introspect.portal.ContactDetails"
     * cascade="save-update"
     * column="contactdetails_id" not-null="false" unique="true" 
     */   
   public ContactDetails getContactDetails() {
      return contactDetails;
   }
   public void setContactDetails(ContactDetails contactDetails) {
      this.contactDetails = contactDetails;
   }
Why am I getting  duplicate unique="true" in the  generated Person.hbm.xml? Is this an xdoclet issue?
Jeff Mutonho
[/code]