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 08-03-2007, 04:41 PM
Member
 
Join Date: Jul 2007
Posts: 32
valery is on a distinguished road
help with inheritance in hibernate
I have the table "Person" in my data base
I'm trying to map in hibernate the Person object and its subclasses
Code:
<hibernate-mapping> <class name="Model.Person" table="Person"> <id name="id" type="integer" column="idPerson"> <generator class="native"/> </id> <property name="name" type="string" column="Name"/> <property name="lastname" type="string" column="Lastname"/> <property name="address" type="string" column="address"/> <property name="email" type="string" column="email"/> <discriminator column="type" type="character"/> <subclass name="Model.Enterprise.Boss" discriminator-value="C"/> </class> </hibernate-mapping>
When I try to map:
Code:
13:05:46,437 INFO Configuration:553 - Reading mappings from resource : Data/person.hbm.xml 13:05:46,500 ERROR XMLHelper:61 - Error parsing XML: XML InputStream(17) 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*,resultset*,(query|sql-query)*)". Error al crear SessionFactoryorg.hibernate.InvalidMappingException: Could not parse mapping document from resource Data/person.hbm.xml Exception in thread "main" java.lang.ExceptionInInitializerError
thanks
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-06-2007, 09:44 PM
Member
 
Join Date: Jul 2007
Posts: 41
gabriel is on a distinguished road
try with this:
Code:
el mapeo me quedo asi <hibernate-mapping> <class name="Model.Person" table="Person"> <id name="id" type="integer" column="idPerson"> <generator class="native"/> </id> <discriminator column="type" type="character"/> <property name="name" type="string" column="Name"/> <property name="lastname" type="string" column="Lastname"/> <property name="address" type="string" column="address"/> <property name="email" type="string" column="email"/> <subclass name="Model.Enterprise.Boss" discriminator-value="C"/> </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
inheritance and aggregation java_fun2007 New To Java 3 12-13-2007 02:36 PM
Inheritance mew New To Java 1 12-07-2007 07:08 PM
Multiple Inheritance mew New To Java 1 12-01-2007 11:04 PM
org.hibernate.ejb.Version <clinit> INFO: Hibernate EntityManager 3.2.0.CR1 Heather Database 2 06-30-2007 04:01 PM
Inheritance in GUI Marty SWT / JFace 2 05-11-2007 01:54 AM


All times are GMT +3. The time now is 08:47 PM.


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