-->
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.  [ 5 posts ] 
Author Message
 Post subject: SessionImpl.updateReachableCollection Error
PostPosted: Thu Oct 30, 2003 6:53 pm 
Newbie

Joined: Thu Oct 30, 2003 6:41 pm
Posts: 4
Hi,
I am trying to insert data into a table. I have to do so in a cascading manner. Let me give you a brief idea. I have an Object A which contains a collection of Object B.
Now when i try to insert Object A into a Table A, i would like to insert data of Object B into Table B.

i have coded the files as per many examples that i ahev found in the site and in the reference doc. However while saving data i get the following error...

java.lang.NullPointerException
at net.sf.hibernate.impl.SessionImpl.updateReachableCollection(SessionImpl.java:2539)
at net.sf.hibernate.impl.SessionImpl.updateReachable(SessionImpl.java:2577)
at net.sf.hibernate.impl.SessionImpl.updateReachables(SessionImpl.java:2682)
at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2259)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2017)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2004)

My Mapping files are as shown below
For Object A its...
<bag name="_objectAList" inverse="true" cascade="all">
<key column="OBJECTA_ID"/>
<one-to-many class="ObjectB"/>
</bag>

For Object B its ...
<many-to-one name="_objectA" column="OBJECTA_ID" not-null="true"/>

Any ideas as to why this could be happening.

Thanx.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 30, 2003 6:58 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Czn you show the code that fill A, B and save A. Did you do b.setObjectA(a) before saving

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 30, 2003 6:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Nowhere near enough information. especially, make sure you try the code against the latest release of Hibernate 2.1 (2.1beta5) before anything else.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 30, 2003 7:28 pm 
Newbie

Joined: Thu Oct 30, 2003 6:41 pm
Posts: 4
Hey thanx guys for the suggestions,
I resolved that issue by adding the <update-value="any"> attrbute in the <id> tag of ObjectB

However i would appreciate if i could get site/ doc which explains what exactly update-value does. I mean what does the value any,null or none actually indicate...

Thanx & Warm Regards.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 30, 2003 7:47 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
section 7.5 of the reference guide
Quote:
The unsaved-value attribute of the <id> mapping specifies which identifier values should be interpreted as representing a "new" instance.
The allowed values of unsaved-value are:
* any - always save
* none - always update
* null - save when identifier is null (this is the default)
* valid identifier value - save when identifier is null or the given value

_________________
Emmanuel


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