• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate beginner

 
Ranch Hand
Posts: 50
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am trying to retrive data from MySql database using hibernate and getting an error in ..hbm.xml file "The content of element type "class" 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*,fetch-profile*,resultset*,(query|sql-query)*)"."

HibernatePoJo.hbm.xml:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping SYSTEM " http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.cardinal.hibernate">
<class name="HibernatePoJo" table="Person">
<discriminator column="AGE" type="int" />
<discriminator column="name" type="string"/>
<discriminator column="ExamNo" type="int" />
</class>
</hibernate-mapping>



POJO class name:HibernatePoJo.java
MySql Table name: Person

I haven't specify <id>...</id> because in my database I didnt set any column as primary. Can anyone tell me why it is throwing error in the <class name ..>?
 
Greenhorn
Posts: 3
Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Map your HibernatePojo.hbm.xml to the Hibernate.cfg.xml configuration file:

<Mapping resource="Hibernate.hbm.xml"/>
</hibernate-mapping>
 
reply
    Bookmark Topic Watch Topic
  • New Topic