Hello,
I am trying to a many-to-many list inside as joind-subclass.
If I remove the List from the mapping file. I do not get any errors.
I am already trying for day's so please HELP ME!
I use HBN2.1.8
This is the mapping file and the failure trace:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 1.1//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd">
<hibernate-mapping
>
<class
name="eindwerk.stockbeheer.Artikel"
table="Artikel"
>
<id
name="artikelId"
column="artikelId"
type="java.lang.Integer"
unsaved-value="null"
>
<generator class="native">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-Artikel.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<property
name="minimumStock"
type="java.lang.Float"
column="minimumStock"
/>
<property
name="omschrijving"
type="java.lang.String"
column="omschrijving"
/>
<property
name="stockageEenheid"
type="java.lang.String"
column="stockageEenheid"
/>
<property
name="transportKosten"
type="java.lang.Float"
column="transportKosten"
/>
<property
name="verpakking"
type="java.lang.String"
column="verpakking"
/>
<property
name="artikelNr"
type="java.lang.Integer"
column="artikelNr"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Artikel.xml
containing the additional properties and place it in your merge dir.
-->
<joined-subclass
name="eindwerk.stockbeheer.StockArtikel"
table="stockArtikel"
>
<key
column="artikelId"
/>
<property
name="geleverd"
type="boolean"
column="geleverd"
/>
<property
name="prijs"
type="java.lang.Float"
column="prijs"
/>
</joined-subclass>
<joined-subclass
name="eindwerk.stockbeheer.StandaardArtikel"
table="standaardArtikel"
>
<key
column="artikelId"
/>
<list
role="leveranciers"
table="standaardArtikelLeverancier"
lazy="false"
cascade="none"
>
<key
column="artikelId"
>
</key>
<index
column="leveranciersIndex"
/>
<many-to-many
class="eindwerk.stockbeheer.Leverancier"
column="leveranciersId"
outer-join="auto"
/>
</list>
</joined-subclass>
</class>
</hibernate-mapping>
java.lang.RuntimeException: net.sf.hibernate.MappingException: Error reading resource: eindwerk/stockbeheer/Artikel.hbm.xml
at eindwerk.hibernate.HibernatePersistence.<init>(HibernatePersistence.java:35)
at eindwerk.hibernate.HibernatePersistence.getInstance(HibernatePersistence.java:41)
at eindwerk.hibernate.HibernateSession.currentSession(HibernateSession.java:39)
at eindwerk.stockbeheer.test.TestArtikel.testNieuwStockArtikelInDB(TestArtikel.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
Caused by: net.sf.hibernate.MappingException: Error reading resource: eindwerk/stockbeheer/Artikel.hbm.xml
at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:358)
at eindwerk.hibernate.HibernatePersistence.<init>(HibernatePersistence.java:28)
... 18 more
Caused by: net.sf.hibernate.MappingException: java.lang.NullPointerException
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:297)
at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:355)
... 19 more
Caused by: java.lang.NullPointerException
at net.sf.hibernate.util.StringHelper.qualify(StringHelper.java:241)
at net.sf.hibernate.cfg.Binder.bindCollection(Binder.java:509)
at net.sf.hibernate.cfg.Binder$3.create(Binder.java:1441)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1028)
at net.sf.hibernate.cfg.Binder.bindJoinedSubclass(Binder.java:216)
at net.sf.hibernate.cfg.Binder.handleJoinedSubclass(Binder.java:1087)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1058)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:362)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:253)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:289)
... 20 more
|