-->
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.  [ 3 posts ] 
Author Message
 Post subject: NullPointerException in Bag after update
PostPosted: Thu Jul 22, 2004 8:11 am 
Newbie

Joined: Thu May 06, 2004 12:36 pm
Posts: 3
Hello,

I have one Problem...

- Resin 2.1.12 with mySQL and Oracle 8i. ( I was testing both )

Here is one of the mapping documents:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
   package="somepackage.group.model">

   <class name="Group" table="contactGroup" discriminator-value="N">      
      <id name="id" column="Group_ID">
         <generator class="native"/>
      </id>      
      <version name="lastChange" type="timestamp"/>      
      
      <property name="name" not-null="true">            
         <column name="name" sql-type="varchar(50)" />
      </property>
      
      <property name="type" column="group_type" type="somepackage.group.model.GroupType" not-null="true"/>
      
      <bag name="members" table="group_member" lazy="true" inverse="false">
         <key column="GROUP_ID"/>
         <many-to-many class="Contact" column="CONTACT_ID" />
      </bag>
      
      <many-to-one name="subscriber" column="Subscriber_ID" not-null="true"/>
      
   </class>   
</hibernate-mapping>


the contact has this bag-mapping

Code:
<bag name="groups" lazy="true" table="group_member" inverse="true">
         <key column="CONTACT_ID"/>
         <many-to-many class="Group" column="GROUP_ID"/>
</bag>


Everything is working fine, but after updating the contact and accessing the members of the group I get this Exception:

Code:
java.lang.NullPointerException
   at net.sf.hibernate.collection.Bag.toString(Bag.java:483)

inside the logging statement.

The Update is done using a Transaction with commit.
When switching the Group to
Code:
lazy="false"
it is working fine...

Please help me :-(

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 26, 2004 7:12 am 
Newbie

Joined: Thu May 06, 2004 12:36 pm
Posts: 3
I just made some more tests... and found something.

Before updating the Contact I do this:
Code:
SamSessionFactory.getSession().iterate("from Group");


and erveything works... Don't know why..


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 26, 2004 9:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
We are not psychic and cannot provide assisitance unless you provide code and full stack traces. Read the forum instructions before posting again.


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