-->
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.  [ 10 posts ] 
Author Message
 Post subject: subclass problem / no persistent classes
PostPosted: Fri Feb 27, 2004 9:12 am 
Beginner
Beginner

Joined: Tue Nov 25, 2003 11:55 am
Posts: 23
since we've declared subclass-mapping in it's own file, our selects over those objects failed.

mapping of subclass:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<subclass name="dbfps.partner.po.FPSGeschaeftspartnerPO"
extends="com.carano.cbf.partner.po.GeschaeftspartnerPO" table="AV_G_PARTNER">
<key column="G_PARTNER_ID"/>
<property name="bahnstelle" column="BAHNSTELLE"/>
<property name="kostenstelle" column="KOSTENSTELLE"/>
<!-- Log timestamps/ ids -->
<property name="IDMitarbeiterInsert" column="MITARB_ID_INS" not-null="false"
unique="false" />
<property name="IDMitarbeiterUpdate" column="MITARB_ID_UPD" not-null="false"
unique="false" />
<property name="TSInsert" column="TS_INSERT" not-null="false" unique="false"
/>
<property name="TSUpdate" column="TS_UPDATE" not-null="false" unique="false"
/>
</subclass>
</hibernate-mapping>


there is no exception but following warning in log-file:

WARN[net.sf.hibernate.hql.QueryTranslator] no persistent classes found for query class: SELECT DISTINCT FPSGeschaeftspartnerPO
FROM
dbfps.partner.po.FPSGeschaeftspartnerPO AS FPSGeschaeftspartnerPO
WHERE
( (FPSGeschaeftspartnerPO.bahnstelle IS NULL ) OR
( FPSGeschaeftspartnerPO.bahnstelle LIKE '%') )

same query works, if subclass-mapping was declared in mapping of base class.

Subclass was added to Configuration, but it's later not listed in persistentClasses-Map of SessionFactoryImpl

what is wrong?

kersten


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 9:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Are you using a recent Hibernate version?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 10:28 am 
Beginner
Beginner

Joined: Tue Nov 25, 2003 11:55 am
Posts: 23
we're using hibernate2


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 10:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well, which version? extends is only possible since 2.1 beta 2


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 10:32 am 
Beginner
Beginner

Joined: Tue Nov 25, 2003 11:55 am
Posts: 23
version 2.0.1 17 June 2003

ok seems to be the wrong version


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 10:46 am 
Beginner
Beginner

Joined: Tue Nov 25, 2003 11:55 am
Posts: 23
so, downloaded new hibernate jar, version is now version 2.1.2, 4 February 2003,
but the problem still exists


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 11:24 am 
Beginner
Beginner

Joined: Tue Nov 25, 2003 11:55 am
Posts: 23
my fault i had a bad classpath, were old hbernate.jar was still included, now something changed and i got this following exception



net.sf.hibernate.MappingException: Error reading resource: dbfps/partner/po/FPSGeschaeftspartnerPO.hbm.xml
at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:336)
at fleet.persistence.HibernateMappingInitializer.initialize(HibernateMappingInitializer.java:70)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.media_saturn.framework.abo.persistence.hibernate.HibernatePersistencehandler.getInitializedConfiguration(HibernatePersistencehandler.java:617)
at com.media_saturn.framework.abo.persistence.hibernate.HibernatePersistencehandler.createSessionFactory(HibernatePersistencehandler.java:661)
at com.media_saturn.framework.abo.persistence.hibernate.HibernatePersistencehandler.doInitialize(HibernatePersistencehandler.java:509)
at com.media_saturn.framework.abo.persistence.AbstractPersistencehandler.initialize(AbstractPersistencehandler.java:70)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.media_saturn.framework.util.pooling.Pool$ElementProxy.invoke(Pool.java:304)
at com.media_saturn.framework.abo.persistence.PersistenceManager$PersistencehandlerProxy.invoke(PersistenceManager.java:378)
at $Proxy0.initialize(Unknown Source)
at com.media_saturn.framework.abo.persistence.PersistenceManager$PersistencehandlerInitializer.initialize(PersistenceManager.java:444)
at com.media_saturn.framework.util.pooling.Pool.get(Pool.java:472)
at com.media_saturn.framework.abo.persistence.PersistenceManager.getPersistencehandler(PersistenceManager.java:460)
at com.media_saturn.framework.abo.persistence.PersistenceManager.getPersistencehandlerFor(PersistenceManager.java:475)
at com.media_saturn.framework.abo.persistence.PersistenceManager.initializePersistencehandlerFor(PersistenceManager.java:99)
at fleet.client.gui.Main.initializeMappingLocal(Main.java:218)
at fleet.client.gui.Main.<init>(Main.java:76)
at fleet.client.gui.Main.main(Main.java:234)
Caused by: net.sf.hibernate.MappingException: invalid mapping
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:284)
at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:333)
... 22 more
Caused by: org.xml.sax.SAXParseException: Attribute "table" must be declared for element type "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.addDTDDefaultAttrsAndValidate(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(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.DTDConfiguration.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)
... 23 more



mapping file is still the same and it contains the table attribute


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 11:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
The doctype should read
Code:
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 11:39 am 
Beginner
Beginner

Joined: Tue Nov 25, 2003 11:55 am
Posts: 23
it hasn't changed anything

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<subclass name="dbfps.partner.po.FPSGeschaeftspartnerPO"
extends="com.carano.cbf.partner.po.GeschaeftspartnerPO" table="AV_G_PARTNER">
<key column="G_PARTNER_ID"/>
<property name="bahnstelle" column="BAHNSTELLE"/>
<property name="kostenstelle" column="KOSTENSTELLE"/>
<!-- Log timestamps/ ids -->
<property name="IDMitarbeiterInsert" column="MITARB_ID_INS" not-null="false"
unique="false" />
<property name="IDMitarbeiterUpdate" column="MITARB_ID_UPD" not-null="false"
unique="false" />
<property name="TSInsert" column="TS_INSERT" not-null="false" unique="false"
/>
<property name="TSUpdate" column="TS_UPDATE" not-null="false" unique="false"
/>
</subclass>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 11:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I don't think the table attribute is needed for <subclass>, try leaving it out. Look at the DTD and try to be conformant to it, it should work.


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