-->
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.  [ 3 posts ] 
Author Message
 Post subject: inheritance mapping is failed
PostPosted: Thu Jul 12, 2007 4:41 pm 
Newbie

Joined: Mon Jul 09, 2007 9:32 am
Posts: 17
I want to use inheritance mapping, but I am failed.

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

<hibernate-mapping>   
   
    <class name="data.User" table="mts_user" >
       <cache usage="read-write"/>       
        <id name="userId" column="userId">
            <generator class="increment"/>
        </id>             
        <property name="userName"/>
        <property name="active" type="java.lang.Boolean" />
       
        <discriminator>
           <column name="DISCRIMINATOR"/>
       </discriminator>            
           
        <subclass name="data.Employee" discriminator-value="EMPLOYEE">
           <property name="salary" />       
       </subclass>
               
    </class>   
   
</hibernate-mapping>


Why I always get error :
Code:
Caused by: org.xml.sax.SAXParseException: 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)*)".
   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
   at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2048)
   at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:932)
   at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
   at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
   at org.dom4j.io.SAXReader.read(SAXReader.java:465)
   at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:499)
   ... 73 more


is this XML Parser problem ? I am using Eclipse 3.2 and SDK 1.5 .

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 12, 2007 6:24 pm 
Beginner
Beginner

Joined: Tue Jun 26, 2007 2:31 pm
Posts: 21
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

<class name="data.User" table="mts_user">
<cache usage="read-write"/>
<id name="userId" column="userId">
<generator class="increment"/>
</id>

<discriminator column="" type="string"></discriminator>

<property name="userName"/>
<property name="active" type="java.lang.Boolean" />



<subclass name="data.Employee" discriminator-value="EMPLOYEE">
<property name="salary" />

</subclass>

</class>

</hibernate-mapping>

Try using this:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 12, 2007 7:54 pm 
Newbie

Joined: Mon Jul 09, 2007 9:32 am
Posts: 17
sainaveenp,

Perfect. It works. The problem is , how did you find it ?

Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.