-->
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.  [ 2 posts ] 
Author Message
 Post subject: Invalid Mapping Error
PostPosted: Mon Jul 26, 2004 5:39 pm 
Newbie

Joined: Mon Jul 26, 2004 5:31 pm
Posts: 1
Hi All,
I'm in the process of evaluating Hibernate for a web project and i have
i get the following error when i try to find records

[27/07/04 09:36:41:187 NZST] 28ab28ab XMLHelper E net.sf.hibernate.util.XMLHelper Error parsing XML: XML InputStream(90) The content of element type "class" is incomplete, it must match "(meta*,(cache|jcs-cache)?,(id|composite-id),discriminator?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-array)*,(subclass*|joined-subclass*))".

my mapping document is

Quote:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping>
<class name="NZOlasPolicy" table="LLDCA">

<id name="companyCode" column="CACO" type="long" unsaved-value="null" >
<generator class="hilo"/>
</id>
<id name="policyNumber" column="CAPOLNUM" type="string" length="10" >
<generator class="hilo"/>
</id>

<property name="riderNumber" column="CARIDNUM" type="int" />
<property name="trailerId1" column="CATRLRID1" type="int" />
<property name="trailerId2" column="CATRLRID2" type="int" />
<property name="trailerId3" column="CATRLRID3" type="int" />
<property name="trailerId4" column="CATRLRID4" type="int" />
<property name="trailerId5" column="CATRLRID5" type="int" />
<property name="trailerId6" column="CATRLRID6" type="int" />
<property name="trailerId7" column="CATRLRID7" type="int" />
<property name="trailerId8" column="CATRLRID8" type="int" />
<property name="trailerId9" column="CATRLRID9" type="int" />
<property name="trailerId10" column="CATRLRID10" type="int" />
<property name="trailerId11" column="CATRLRID11" type="int" />
<property name="trailerId12" column="CATRLRID12" type="int" />

<property name="paidToDateYY" column="CAPDTOYY" type="string" length="2" />
<property name="paidToDateMM" column="CAPDTOMM" type="string" length="2" />
<property name="paidToDateDD" column="CAPDTODD" type="string" length="2" />

<property name="billedUpYear" column="CABILDYY" type="string" length="2" />
<property name="billedUpMonth" column="CABILDMM" type="string" length="2" />
<property name="subDateYY" column="CASUBYY" type="string" length="2" />
<property name="subDateMM" column="CASUBMM" type="string" length="2" />
<property name="subDateDD" column="CASUBDD" type="string" length="2" />
<property name="issueDateYY" column="CAYYISS" type="string" length="2" />
<property name="issueDateMM" column="CAMMISS" type="string" length="2" />
<property name="issueDateDD" column="CADDISS" type="string" length="2" />

<property name="suspend" column="CASUSPD" type="string" length="1" />
<property name="status" column="CASTATUS" type="string" length="2" />

<property name="duration" column="CADUR" type="int" />
<property name="billingFormCode" column="CABFORM" type="string" length="1" />
<property name="mode" column="CABMODE" type="int" />

<property name="billingDay" column="CABDAY" type="double" />
<property name="billingDayUseCode" column="CABDAYUSE" type="string" length="1" />
<property name="billingControlNumber" column="CACONTROL" type="string" length="10"/>
<property name="annualPremium" column="CAAPREM" type="double" />

<property name="semiAnnualPremium" column="CASPREM" type="double" />
<property name="quarterlyPremium" column="CAQPREM" type="double" />
<property name="monthlyPremium" column="CAMPREM" type="double" />
<property name="policyFeeAmount" column="CAPOLFEE" type="double" />
<property name="modeRuleCode" column="CAMRULE" type="string" length="3" />
<property name="specialHandlingCode" column="CAHANDL" type="string" length="1" />
<property name="specialCode" column="CASPEC" type="string" length="1" />
<property name="nonforfeitureCode" column="CANFO" type="string" length="1" />

<property name="automaticPremiumLoanCode" column="CAAPL" type="string" length="1" />
<property name="suspenseTypeCode1" column="CASUSTYP1" type="string" length="1" />
<property name="suspenseAmount1" column="CASUSAMT1" type="double" />
<property name="suspenseDate1" column="CASUSDATE1" type="string" length="6" />
<property name="suspenseTypeCode2" column="CASUSTYP2" type="string" length="1" />
<property name="suspenseAmount2" column="CASUSAMT2" type="double" />
<property name="suspenseDate2" column="CASUSDATE2" type="string" length="6" />

<property name="suspenseTypeCode3" column="CASUSTYP3" type="string" length="1" />
<property name="suspenseAmount3" column="CASUSAMT3" type="double" />
<property name="suspenseDate3" column="CASUSDATE3" type="string" length="6" />

<property name="insuredName" column="CAINAME" type="string" length="30" />
<property name="ownerName" column="CAONAME" type="string" length="30" />
<property name="taxUse" column="CATAXUSE" type="string" length="1" />
<property name="taxId" column="CATAXID" type="string" length="9" />
<property name="state" column="CASTATE" type="string" length="2" />
<property name="country" column="CACNTY" type="string" length="4" />
<property name="city" column="CACITY" type="string" length="5" />
<property name="lastTransactionDateYY" column="CALTYY" type="string" length="2" />
<property name="lastTransactionDateMM" column="CALTMM" type="string" length="2" />
<property name="lastTransactionDateDD" column="CALTDD" type="string" length="2" />
<property name="lastTransactionType" column="CALTRTYPE" type="string" length="1" />
<property name="lastAccountDateYY" column="CALTAYY" type="string" length="2" />
<property name="lastAccountDateMM" column="CALTAMM" type="string" length="2" />
<property name="lastAccountDateDD" column="CALTADD" type="string" length="2" />

</class>
</hibernate-mapping>



Code:

      Collection coll = null;
      try {
         Properties props = new Properties();
         props.load(getClass().getResourceAsStream ("hibernate.properties"));
         Configuration cfg = new Configuration().addClass(com.aia.jdo.nzac.NZOlasPolicy.class);
         cfg.setProperties(props);
         SessionFactory factory = cfg.buildSessionFactory();
         Session session = factory.openSession();
         String name = "Sudha-Cricket";
         //Team team = (Team) session.find("from team in class Team where team.name like ?", name,Hibernate.STRING).get(0);
         //Team team = (Team) session.find("from team in class Team where team.id > 1000").get(0);
         coll = session.find("from policy in class NZOlasPolicy where policy.companyCode = '0970'");
         Iterator i=coll.iterator();
         System.out.println("Total Size...:" + coll.size());
         while(i.hasNext()){
            //Team team = (Team)i.next();
            //System.out.println(team.getId()+"\t"+team.getName()+"\t"+team.getCity());
         }
         
      } catch (Exception e) {
         
         e.printStackTrace();
      }



any help would be appreciated[/code][/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 26, 2004 5:41 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
The error message is quite descriptive. You can't have several <id> mapping elements. I think you are looking for <composite-id>. Please read the documentation before using it.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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