-->
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.  [ 7 posts ] 
Author Message
 Post subject: Problem with my mapping file
PostPosted: Wed Jun 15, 2005 11:46 am 
Beginner
Beginner

Joined: Thu Jun 09, 2005 3:18 am
Posts: 34
Location: India
Hi...here is my mapping file. my database is db2
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="infozeal.Categories" table="Administrator.CTGR_LIST">

<property name="CTGR_TYPE_CD" column="CTGR_TYPE_CD" type="String"/>

<property name="CTGR_TYPE_DSCR_TX" column="CTGR_TYPE_DSCR_TX" type="String"/>
<property name="CTGR_LVL_1_TX" column="CTGR_LVL_1_TX" type="String"/>
<property name="CTGR_LVL_2_TX" column="CTGR_LVL_2_TX" type="String"/>
<property name="CTGR_LVL_3_TX" column="CTGR_LVL_3_TX" type="String"/>
<property name="CTGR_LVL_4_TX" column="CTGR_LVL_4_TX" type="String"/>
</class>
</hibernate-mapping>


my java file

public class CategoryList implements Serializable
{
private String CTGR_TYPE_CD=null;
private String CTGR_TYPE_DSCR_TX=null;
private String CTGR_LVL_1_TX=null;
private String CTGR_LVL_2_TX=null;
private String CTGR_LVL_3_TX=null;
private String CTGR_LVL_4_TX=null;

//CTGR_TYPE_CODE GET METHOD
public String getCTGR_TYPE_CD()
{
return CTGR_TYPE_CD;
}
// CTGR_TYPE_CODE SET METHOD
private void setCTGR_TYPE_CD(String CTGR_TYPE_CD)
{
this.CTGR_TYPE_CD=CTGR_TYPE_CD;
}

// CTGR_TYPE_DSCR_TX GET METHOD
public String getCTGR_TYPE_DSCR_TX()
{
return CTGR_TYPE_DSCR_TX;
}
// CTGR_TYPE_DSCR_TX SET METHOD
private void setCTGR_TYPE_DSCR_TX(String CTGR_TYPE_DSCR_TX)
{
this.CTGR_TYPE_DSCR_TX=CTGR_TYPE_DSCR_TX;
}

// CTGR_TYPE_LVL_1_TX GET METHOD
public String getCTGR_LVL_1_TX()
{
return CTGR_LVL_1_TX;
}
// CTGR_TYPE_LVL_1_TX SET METHOD
private void setCTGR_LVL_1_TX(String CTGR_LVL_1_TX)
{
this.CTGR_LVL_1_TX=CTGR_LVL_1_TX;
}

// CTGR_TYPE_LVL_2_TX GET METHOD
public String getCTGR_LVL_2_TX()
{
return CTGR_LVL_2_TX;
}
// CTGR_TYPE_LVL_2_TX SET METHOD
private void setCTGR_LVL_2_TX(String CTGR_LVL_2_TX)
{
this.CTGR_LVL_2_TX=CTGR_LVL_2_TX;
}

// CTGR_TYPE_LVL_3_TX GET METHOD
public String getCTGR_LVL_3_TX()
{
return CTGR_LVL_3_TX;
}
// CTGR_TYPE_LVL_3_TX SET METHOD
private void setCTGR_LVL_3_TX(String CTGR_LVL_3_TX)
{
this.CTGR_LVL_3_TX=CTGR_LVL_3_TX;
}
// CTGR_TYPE_LVL_4_TX GET METHOD
public String getCTGR_LVL_4_TX()
{
return CTGR_LVL_4_TX;
}
// CTGR_TYPE_LVL_4_TX SET METHOD
private void setCTGR_LVL_4_TX(String CTGR_LVL_4_TX)
{
this.CTGR_LVL_4_TX=CTGR_LVL_4_TX;
}
}




i getting following error

21:17:28,175 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(16) The content of element type "class" 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*))".
net.sf.hibernate.MappingException: Error reading resource: infozeal/Categories.hbm.xml
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:340)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1027)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:983)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:911)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 15, 2005 11:49 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
The content of element type "class" 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*))".


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2005 12:39 am 
Beginner
Beginner

Joined: Thu Jun 09, 2005 3:18 am
Posts: 34
Location: India
????

my table structure is..

CTGR_TYPE_CD char(4)
CTGR_TYPE_DSCR_TX String
CTGR_LVL_1_TX String
CTGR_LVL_2_TX String
CGR_LVL_3_TX String
CTGR_LVL_4_TX String


i dont have any primary keys in this table

I wnat to right a mapping file for this table.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2005 12:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
The XML parser is throwing an exception because you have XML that is not valid according to the Hibernate DTD. So .... fix the XML.


(You are missing an <id>.)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2005 12:51 am 
Beginner
Beginner

Joined: Thu Jun 09, 2005 3:18 am
Posts: 34
Location: India
I dont have any identifiers in my database table. how can i user <id>


Top
 Profile  
 
 Post subject: Id is mandatory
PostPosted: Thu Jun 16, 2005 4:50 am 
Newbie

Joined: Wed Jun 08, 2005 3:15 am
Posts: 5
Hi

ID is mandatory while working with hibernate.

Even if u dont have any primary key in ur table., U should have an id defined in the mapping file as well as POJO class., Hibernate expects that every persistable domain object (mapping document) should have Id .


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2005 5:14 am 
Regular
Regular

Joined: Wed Feb 02, 2005 6:33 am
Posts: 70
Hibernate requires an id so that on updates, it can ensure that it updates the correct data. If you do not have any single value that will be unique, look at using a composite id using multiple columns, from 2 columns up to and including all columns.


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