Bookmark Topic Watch Topic
  • New Topic

problem with hibernate mapping

Mr. Ashish Mathur
Posts: 2
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 3953
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please continue the discussion in your other thread.
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!