Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-25-2007, 09:35 PM
Ed Ed is offline
Senior Member
 
Join Date: Jun 2007
Posts: 110
Ed is on a distinguished road
Hibernate subclasses
I want to map a subclass but I can't do it

the employee is a SUBCLASS of contact
Code:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name=" entity.Contact" table="contact" > <id name="id_contact" column="id_contact" unsaved-value="0"> <generator class="identity"/> </id> <property name="name" column="name" type="string"/> <property name="lastname" column="lastname" type="string"/> <property name="address" column="address" type="string"/> <property name="city" column="city" type="string"/> <discriminator column="contact"/> <subclass name="entity.Employee" discriminator-value="B"> </subclass> </class> </hibernate-mapping>
the error is
Code:
688 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(26) The content of element type "class" must match "(meta*,subselect?,cache? ,synchronize*,(id|composite-id),discriminator?,(version|timestamp)?, (property|many-to-one|one-to-one|component|dynamic-component |properties|any|map|set|list|bag|idbag|array|primitive-array|query-list)*, ((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert? ,sql-update?,sql-delete?,filter*)".
do you know what is the problem?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-02-2007, 05:40 PM
bbq bbq is offline
Senior Member
 
Join Date: Jun 2007
Posts: 134
bbq is on a distinguished road
The problem is the order of the tags xml, that is the cause of the problem
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-02-2007, 05:42 PM
Senior Member
 
Join Date: Jun 2007
Posts: 164
Heather is on a distinguished road
bbq is right
El tag discriminator must be after the id. I send you the correct xml
Code:
<hibernate-mapping> <class name=" entity.Contact" table="contact" > <id name="id_contact" column="id_contact" unsaved-value="0"> <generator class="identity"/> </id> <!-- HERE --> <discriminator column="contact"/> <!--******** --> <property name="name" column="name" type="string"/> <property name="lastname" column="lastname" type="string"/> <property name="address" column="address" type="string"/> <property name="city" column="city" type="string"/> <subclass name="entity.Employee" discriminator-value="B"> </subclass> </class> </hibernate-mapping>
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hibernate, help me Nick15 Database 2 06-05-2008 04:39 PM
Can I use annotations in superclass, and .cfg.xml files in subclasses in EJB3 narayanrec Enterprise JavaBeans 4 01-06-2008 03:40 AM
Can I use annotations in superclass, and .cfg.xml files in subclasses narayanrec Database 0 01-02-2008 05:24 AM
help needed with methods in subclasses uncopywritable New To Java 4 08-01-2007 02:47 PM
org.hibernate.ejb.Version <clinit> INFO: Hibernate EntityManager 3.2.0.CR1 Heather Database 2 06-30-2007 04:01 PM


All times are GMT +3. The time now is 02:29 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org