• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate throwing SAXPasesExceptions

 
mvPrasad Regula
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I try to save data from a form into database using hibernate, I am getting the following error
Caused by: org.xml.sax.SAXParseException: The content of element type "hibernate-mapping" must match "(meta*,import*,(class|subclass|joined-subclass)*,query*,sql-query*)". I have pasted the Address.hbm.xml file below. Thanks in advance

<?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>
private Integer id;
private String fname;
private String lname;
private Integer hno;
private String street;
private String city;
private String state;
private Integer zipcode;
<class
name="com.web.pojo.Address"
table="t_addressbook"
dynamic-update="false"
dynamic-insert="false">
<id
name="id"
column="addid"
type="java.lang.Integer">
<generator class="uuid.hex"/>
</id>
<property
name="fname"
type="java.lang.String"
update="true"
insert="true"
column="fname"/>
<property
name="lname"
type="java.lang.String"
update="true"
insert="true"
column="lname"/>
<property
name="hno"
type="java.lang.Integer"
update="true"
insert="true"
column="Hno"/>
<property
name="street"
type="java.lang.String"
update="true"
insert="true"
column="streetname"/>
<property
name="city"
type="java.lang.String"
update="true"
insert="true"
column="city"/>
<property
name="state"
type="java.lang.String"
update="true"
insert="true"
column="state"/>
<property
name="zipcode"
type="java.lang.Integer"
update="true"
insert="true"
column="zip"/>
</class>

<query name="address.dao.find"><![CDATA[
select Address from com.web.pojo.Address as address where address.addrid= :id]]></query>

</hibernate-mapping>
 
Ranveer K Kumar
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
howand why wrote:When I try to save data from a form into database using hibernate, I am getting the following error
Caused by: org.xml.sax.SAXParseException: The content of element type "hibernate-mapping" must match "(meta*,import*,(class|subclass|joined-subclass)*,query*,sql-query*)"


"(meta*,import*,(class|subclass|joined-subclass)*,query*,sql-query*)"

follow the above hierarchy in the hibernate mapping file...
 
Christian Dillinger
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Throw out that java code...

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic