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