-->
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.  [ 9 posts ] 
Author Message
 Post subject: MappingExeption With inheritance and m-to-m
PostPosted: Sat Mar 26, 2005 6:37 am 
Newbie

Joined: Sat Mar 26, 2005 6:31 am
Posts: 14
Hello,

I get an java.lang.RuntimeException: net.sf.hibernate.MappingException
When I use this in my mapping. If I remove the set. the problem is gone, so the problem must be there.
Hbn version = 2.1


Thanks,
Steven

<?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="id"
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"
/>

<set
role="leveranciers"
table="standaardArtikelLeverancier"
lazy="false"

>

<key
column="artikelId"
>
</key>

<many-to-many
class="eindwerk.stockbeheer.Leverancier"
column="leveranciersId"

/>

</set>

</joined-subclass>

</class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2005 6:44 am 
Regular
Regular

Joined: Thu Dec 11, 2003 4:14 pm
Posts: 86
Location: Hibernate 3 + annotations, Oracle 9i, PostgreSQL 8.0, Java 1.5.0
Could you post a little more stacktrace please.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2005 6:47 am 
Newbie

Joined: Sat Mar 26, 2005 6:31 am
Posts: 14
java.lang.RuntimeException: net.sf.hibernate.MappingException: Error reading resource: eindwerk/stockbeheer/Artikel.hbm.xml
at eindwerk.hibernate.HibernatePersistence.<init>(HibernatePersistence.java:33)
at eindwerk.hibernate.HibernatePersistence.getInstance(HibernatePersistence.java:39)
at eindwerk.hibernate.HibernateSession.currentSession(HibernateSession.java:39)
at eindwerk.stockbeheer.test.TestArtikel.testNieuwStockArtikelInDB(TestArtikel.java:74)
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:27)
... 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$2.create(Binder.java:1434)
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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2005 6:54 am 
Regular
Regular

Joined: Thu Dec 11, 2003 4:14 pm
Posts: 86
Location: Hibernate 3 + annotations, Oracle 9i, PostgreSQL 8.0, Java 1.5.0
I am not sure as I am never used the xml-mapping stuff, but for me it looks like the "name" attribute is missing for the "set" element.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2005 8:11 am 
Newbie

Joined: Sat Mar 26, 2005 6:31 am
Posts: 14
It doesn't look like tis is the problem. IS it posible to give an example? It does not have to bee with XML method.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2005 8:38 am 
Regular
Regular

Joined: Thu Dec 11, 2003 4:14 pm
Posts: 86
Location: Hibernate 3 + annotations, Oracle 9i, PostgreSQL 8.0, Java 1.5.0
Sure: http://www.hibernate.org/hib_docs/reference/en/html/collections.html#collections-ofvalues

From user-to-user: What I try to debug such things is to start the debugger - set a breakpoint at at net.sf.hibernate.util.StringHelper.qualify(StringHelper.java:241)
and try to traceback whats wrong.

Shouldnt be too hard ;-)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2005 9:05 am 
Newbie

Joined: Sat Mar 26, 2005 6:31 am
Posts: 14
Is it posible to use a many to many inside a join-subclass?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2005 10:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
You are trying to use a Hibernate 1.x mapping with Hibernate 2.1. That won't work.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2005 11:41 am 
Newbie

Joined: Sat Mar 26, 2005 6:31 am
Posts: 14
Is is possible to show me where I kan find the 2.1 why? because I used the examples from the hibernate manual. And I do not know about another way.


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