-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Subclass mapping problem
PostPosted: Fri Sep 12, 2008 6:46 am 
Newbie

Joined: Fri Sep 12, 2008 6:36 am
Posts: 3
Hi,
I am facing subclass integration issue. Plz guide me.
My hmb.xml mapping
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="com.webdunia.spring.domain.Entity" table="ENTITY">
<cache usage="read-only"/>
<id name="id" column="ID" type="java.lang.String" unsaved-value="null">
<generator class="identity"/>
</id>
<property name="name" column="NAME" type="java.lang.String" not-null="true"/>
<property name="title" column="TITLE" type="java.lang.String"/>
<property name="about" column="ABOUT" type="java.lang.String"/>
<property name="policyStatement" column="POLICYSTATEMENT" type="java.lang.String" not-null="true"/>
<property name="imageRelativePath" column="IMAGERELATIVEPATH" type="java.lang.String" not-null="true"/>
<property name="creationDate" column="CREATIONDATE" type="java.util.Date"/>
<property name="lastModificationDate" column="LASTMODIFICATIONDATE" type="java.util.Date"/>
<property name="timeZoneId" column="TIMEZONEID" type="java.lang.String"/>
<property name="entityState" column="ENTITYSTATE" type="java.lang.String"/>
<property name="role" column="ROLE" type="java.lang.String"/>
<property name="language" column="LANGCODE" type="java.lang.String"/>
<property name="theme" column="THEME" type="java.lang.String"/>
<property name="isAggregationEnabled" column="AGGREGATIONENABLED" type="java.lang.Integer"/>
<property name="isFamilyFilterEnabled" column="FAMILYFILTERENABLED" type="java.lang.Integer"/>
<property name="attributes" column="ATTRIBUTES" type="java.lang.String"/>
<property name="disclaimer" column="DISCLAIMER" type="java.lang.String"/>
<discriminator column="ENTITYOWNERTYPE" type="string">
</discriminator>
<set name="accreditation" table="ACCREDITATION" lazy="false">
<key column="ENTITYID"/>
<composite-element class="com.webdunia.spring.domain.Accreditation">
<property name="id" column="ID" not-null="true"/>
<property name="title" column="TITLE"/>
<property name="about" column="ABOUT"/>
<property name="url" column="URL"/>
<property name="creationDate" column="CREATIONDATE"/>
</composite-element>
</set>
<set name="address" table="ADDRESS" lazy="false">
<key column="ENTITYID"/>
<composite-element class="com.webdunia.spring.domain.Address">
<property name="id" column="ID" not-null="true"/>
<property name="title" column="TITLE"/>
<property name="about" column="ABOUT"/>
<property name="street" column="STREET"/>
<property name="milestone" column="MILESTONE"/>
<property name="city" column="CITY"/>
<property name="state" column="STATE"/>
<property name="country" column="COUNTRY"/>
<property name="pincode" column="PINCODE"/>
<property name="phoneNumbers" column="PHONENUMBERS"/>
<property name="creationDate" column="CREATIONDATE"/>
</composite-element>
</set>
<set name="medicalHistory" table="MEDICALHISTORY" lazy="false">
<key column="ENTITYID"/>
<composite-element class="com.webdunia.spring.domain.MedicalHistory">
<property name="id" column="ID" not-null="true"/>
<property name="title" column="TITLE"/>
<property name="about" column="ABOUT"/>
<property name="creationDate" column="CREATIONDATE"/>
</composite-element>
</set>

<set name="publication" table="PUBLICATION" lazy="false">
<key column="ENTITYID"/>
<composite-element class="com.webdunia.spring.domain.Publication">
<property name="id" column="ID" not-null="true"/>
<property name="title" column="TITLE"/>
<property name="about" column="ABOUT"/>
<property name="url" column="URL"/>
<property name="creationDate" column="CREATIONDATE"/>
</composite-element>
</set>
<set name="practicingMethodology" table="PRACTICINGMETHODOLOGY" lazy="false">
<key column="ENTITYID"/>
<composite-element class="com.webdunia.spring.domain.PracticingMethodology">
<property name="id" column="ID" not-null="true"/>
<property name="title" column="TITLE"/>
<property name="about" column="ABOUT"/>
<property name="creationDate" column="CREATIONDATE"/>
</composite-element>
</set>
<subclass name="com.webdunia.spring.domain.Doctor" discriminator-value="DOCTOR">
<property name="specializations" column="SPECIALIZATIONS"/>
</subclass>
</class>
</hibernate-mapping>

Error:
2008-09-12 16:19:54,329 ERROR [org.hibernate.util.XMLHelper] Error parsing XML: XML InputStream(88) 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)*)".
2008-09-12 16:19:54,329 INFO [STDOUT] %%%% Error Creating HibernateSessionFactory %%%%
2008-09-12 16:19:54,329 INFO [STDOUT] org.hibernate.MappingException: Could not read mappings from resource: Entity.hbm.xml


Plz guide me


Top
 Profile  
 
 Post subject: Subclass mapping problem
PostPosted: Fri Sep 12, 2008 7:47 am 
Newbie

Joined: Fri Sep 12, 2008 6:36 am
Posts: 3
I got the solution. This is xml position problem.

Solution
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="com.webdunia.spring.domain.Entity" table="ENTITY">
<cache usage="read-only"/>
<id name="id" column="ID" type="java.lang.String" unsaved-value="null">
<generator class="identity"/>
</id>
<discriminator column="ENTITYOWNERTYPE" type="string"/>

discriminator tag should be after id tag.
Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.