-->
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.  [ 2 posts ] 
Author Message
 Post subject: saving object / Exception
PostPosted: Wed Feb 11, 2004 5:56 pm 
Newbie

Joined: Mon Sep 08, 2003 3:04 pm
Posts: 12
Hi,

I use Hibernate 1.2.5 and I've a mapping like that :

Quote:
<class name="com.model.formulaires.Tache" table="tbl_taches">

<id name="key" column="id" type="long">
<generator class="sequence">
<param>seq_tbl_taches</param>
</generator>
</id>
<discriminator column="class"/>
...........
<set role="historique" table="tbl_taches" lazy="true" readonly="true">
<key column="history_id"/>
<one-to-many class="com.model.formulaires.Tache"/>
</set>

<subclass name="com.model.formulaires.TacheInternet" discriminator-value="TacheInternet">
<property name="client" type="boolean"/>
</subclass>
</class>


if I try this code

Quote:

Tache tache = (Tache)sqlSession.load(Tache.class, new Long(key));
Tache history = new Tache();
BeanUtils.copyProperties(history, tache);
history.setHistory(tache);
sqlSession.save(history);


The i've an exception :

Quote:

java.lang.NullPointerException
at cirrus.hibernate.collections.Set.elements(Set.java:101)
at cirrus.hibernate.impl.SessionImpl.updateReachableElements(SessionImpl
.java:2074)
at cirrus.hibernate.impl.SessionImpl.updateReachableCollection(SessionIm
pl.java:2060)


If i don't map the Set, I don't have the problem
Any workaround ?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2004 1:12 am 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
Does the readonly="true" have anything to do with it?
My advice:
upgrade your version of hibernate. You're still in the dark ages...


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