• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Hibernate throwing SAXPasesExceptions

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Throw out that java code...

 
I need a new interior decorator. This tiny ad just painted every room in my house purple.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic