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