rocket mass heater kickstarter
The moose likes Object Relational Mapping and the fly likes problem with hibernate mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply locked New topic

problem with hibernate mapping

Mr. Ashish Mathur

Joined: Jan 24, 2012
Posts: 2
hi buddy,
can anyone help me please
i am also facing the same problem .

The content of element type "class" is incomplete, it must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".

could you also help me please.
i am trying to insert data into the table by using hibernate 3 in netbeans 7.
hibernate.cfg.xml file is created in default package with following code snippet

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "">
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/employee</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">admin</property>
<mapping resource="hibernate.hbm.xml"/>
<mapping resource="newHibernate.reveng1.xml"/>
<mapping resource="TestPackage/Emp.hbm.xml"/>

then i created the hibernate reveng xml file in default package

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "">
<schema-selection match-catalog="employee"/>
<table-filter match-name="emp"/>

after it i created the hibernate mapping files(Emp.hbm.xml) and POJOS from database( in another package named NewPackage

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<!-- Generated 24 Jan, 2012 9:55:58 PM by Hibernate Tools 3.2.1.GA -->
<class name="TestPackage.Emp" table="emp" catalog="employee">
<id name="eno" type="int">
<column name="eno" />
<generator class="assigned" />
<property name="ename" type="string">
<column name="ename" length="50" />
<property name="city" type="string">
<column name="city" length="50" />
<property name="basic" type="java.lang.Integer">
<column name="basic" />


package TestPackage;
// Generated 24 Jan, 2012 9:55:58 PM by Hibernate Tools 3.2.1.GA

* Emp generated by hbm2java
public class Emp implements {

private int eno;
private String ename;
private String city;
private Integer basic;

public Emp() {

public Emp(int eno) {
this.eno = eno;
public Emp(int eno, String ename, String city, Integer basic) {
this.eno = eno;
this.ename = ename; = city;
this.basic = basic;

public int getEno() {
return this.eno;

public void setEno(int eno) {
this.eno = eno;
public String getEname() {
return this.ename;

public void setEname(String ename) {
this.ename = ename;
public String getCity() {

public void setCity(String city) { = city;
public Integer getBasic() {
return this.basic;

public void setBasic(Integer basic) {
this.basic = basic;



after it i created hibernate.hbm.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "">
<class name="TestPackage.Emp" table="emp"/>
Vijitha Kumara

Joined: Mar 24, 2008
Posts: 3870

Please continue the discussion in your other thread.

[How to ask questions] [Twitter]
I agree. Here's the link:
subject: problem with hibernate mapping