-->
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.  [ 4 posts ] 
Author Message
 Post subject: MappingException bei Discriminator-Element
PostPosted: Tue Nov 22, 2005 7:35 am 
Newbie

Joined: Tue Oct 18, 2005 11:22 am
Posts: 14
Hallo Leute,

ich hab da ein kleines Newbie-Problem.

Sobald ich ein Discriminator-Element in das Mapping-File für meine abstrakte Superklasse "Vehicle" einfüge, schmiert die Anwendung ab. Nehme ich das Discriminator-Element wieder raus, läuft alles.

Ich kann keinen Tippfehler erkennen. Was mache ich falsch?


Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1

Mapping documents:
<?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 package="de.starclient.transfinance.core.model" default-lazy="false">

<class name="Vehicle" table="T05_VEHICLE">

<id name="id" type="long" column="id">
<generator class="native"/>
</id>
<version name="version" column="version" type="integer"/>

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

<property
name="axles"
column="axles"
type="int"
not-null="true"
/>

<property
name="description"
column="description"
type="string"
/>

<property
name="lpn"
column="lpn"
type="string"
not-null="true"
/>

<property
name="vin"
column="vin"
type="string"
not-null="true"
unique="true"
/>

<property
name="status"
column="status"
type="de.starclient.transfinance.core.model.dao.hibernate.VehicleStatusUserType"
not-null="true"
/>

</class>

</hibernate-mapping>


Full stack trace of any exception that occurs:

Lade Mapping für de.starclient.transfinance.core.model.Vehicle
Error parsing XML: XML InputStream(51) 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)*)".
Fehler beim Starten der Anwendung.
org.hibernate.MappingException: Could not read mappings from resource: de/starclient/transfinance/core/model/Vehicle.hbm.xml

at org.hibernate.cfg.Configuration.addClass(Configuration.java:497)

at de.starclient.application.core.database.DatabaseManager.<init>(DatabaseManager.java:67)

at de.starclient.application.client.STARClientManager.initDatabase(STARClientManager.java:194)

at de.starclient.application.client.STARClientManager.startup(STARClientManager.java:143)

at de.starclient.application.client.ApplicationWorkbenchAdvisor.postStartup(ApplicationWorkbenchAdvisor.java:26)

at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1643)

at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)

at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)

at de.starclient.application.client.Application.run(Application.java:51)

at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)

at org.eclipse.core.launcher.Main.basicRun(Main.java:278)

at org.eclipse.core.launcher.Main.run(Main.java:973)

at org.eclipse.core.launcher.Main.main(Main.java:948)

Caused by: org.hibernate.MappingException: invalid mapping

at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:416)

at org.hibernate.cfg.Configuration.addClass(Configuration.java:494)

... 19 more

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(Unknown Source)

at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)

at org.dom4j.io.SAXReader.read(SAXReader.java:465)

at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:413)

... 20 more


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 7:50 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
wenn ich mich auf die Schnelle nicht irre, muss der "disriminator" VOR dem Versionselement stehen.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 8:49 am 
Newbie

Joined: Tue Oct 18, 2005 11:22 am
Posts: 14
Ich Seggel hatte ganz vergessen, dass es bei den DTD-Angaben (hier im StackTrace) ja auch auf die Reihenfolge ankommt.

Vielen Dank, curio. Das war's. :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 8:54 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
*kicher* bin ja nur froh, dass ich nicht der Einzige bin, dem das passiert ;)


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