-->
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.  [ 5 posts ] 
Author Message
 Post subject: Inheritance Mapping issue
PostPosted: Tue Apr 06, 2004 12:28 pm 
Beginner
Beginner

Joined: Mon Mar 29, 2004 12:41 pm
Posts: 26
Hi all !!

I've a very very boring problem...

Caused by: java.lang.RuntimeException: Exception building SessionFactory: Error reading resource: ../../mapping/Environnement.hbm.xml
at majpps.serveurmad.accesbase.HibernateUtil.<clinit>(HibernateUtil.java:38)
... 33 more
Caused by: net.sf.hibernate.MappingException: Error reading resource: ../../mapping/Environnement.hbm.xml
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:318)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:976)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:856)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:842)
at majpps.serveurmad.accesbase.HibernateUtil.<clinit>(HibernateUtil.java:35)
... 33 more
Caused by: net.sf.hibernate.MappingException: invalid mapping
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:284)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:315)
... 38 more
Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,(cache|jcs-cache)?,(id|composite-id),discriminator?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-array)*,(subclass*|joined-subclass*))".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:339)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:283)


Environnement.hbm.xml is like that :

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

<hibernate-mapping>
<class name="majpps.beans.Environnement" table="environnement" lazy="true">
<id name="idEnv" column="IDENV">
<generator class="sequence">
<param name="seq_environnement">seq_environnement</param>
</generator>
</id>

<property name="nom">
<column name="NOM" sql-type="VARCHAR2(50)" not-null="true"/>
</property>

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

<subclass name="majpps.beans.EnvironnementPoste" lazy="false" discriminator-value="POSTE"
dynamic-update="true" dynamic-insert="true">
<property name="version">
<column name="VERSION" sql-type="VARCHAR2(50)" not-null="true"/>
</property>
</subclass>

<subclass name="majpps.beans.SolutionLecteur" lazy="false" discriminator-value="LECTEUR"
dynamic-update="true" dynamic-insert="true"/>

</class>

</hibernate-mapping>


What's the prob folks please ?? I don't understand... right DTD, right tags... don't really understand and I'm tired of this issue...

Really Thank You !!! Really...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 06, 2004 12:57 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
have you tried "cutting" discriminator + subclasses declaration?
just to test.

Another idea,
move <discriminator column="ENV_TYPE" type="string"/>
before the property declaration...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 07, 2004 3:36 am 
Beginner
Beginner

Joined: Mon Mar 29, 2004 12:41 pm
Posts: 26
Ok, by moving the discriminator tag above property tags it works !! =)

But I have another error now... this one :

Caused by: net.sf.hibernate.MappingException: All subclasses must also have proxies: majpps.beans.Environnement
at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:792)
at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:715)
at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:41)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:137)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:750)
at majpps.serveurmad.accesbase.HibernateUtil.<clinit>(HibernateUtil.java:35)
... 33 more


It's very boring somedays... somedays not... but today it's VERY VERY boring...

=(


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 07, 2004 3:43 am 
Beginner
Beginner

Joined: Mon Mar 29, 2004 12:41 pm
Posts: 26
Hey I've find the solution to my problem !! huh... I dunno if it's really the right solution but it works...

I've put Lazy="false" in the class tag...

Thanks folks !! =)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 07, 2004 8:57 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
oh, of course if you declare lazy='true' in the class definition, that mean the proxy is the class... but you should read doc about this parameter to understand what it exactly do...


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