-->
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.  [ 4 posts ] 
Author Message
 Post subject: Merging a JavaBean fires propertyChange
PostPosted: Sun Mar 12, 2006 1:55 pm 
Beginner
Beginner

Joined: Thu Sep 01, 2005 10:09 am
Posts: 39
This worked with an earlier version. My persistet model objects are all JavaBeans i.e. they fire PropertyChangeEvents when changing an attribute. I need this for certain reasons. But for today ( I upgraded to 3.1.2 plus I changed to use the Java PopoertyChangeSupport had a homegrown solution before) I have a problem when Hibernate tries to merge an entity. It then obviously tries to set an List attribute which causes the PropertyChangeSupport.firePropertyChange to be called (this is new in my code, i had a different lib there before so maybe it is not the upgrading that makes me fail). the firepropertyChange (even if there are no listeners at all, I tested this) does an equals on the list which results in the error shown below. What can I do to get araund this

Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

3.1.2

Mapping documents:

Code between sessionFactory.openSession() and session.close():
Code:
Session session = Application.sessionFactory.openSession();
      Transaction tx = session.beginTransaction();
      
      session.merge(model);
      
      tx.commit();
      session.close();

Full stack trace of any exception that occurs:

Code:
18:47:57,021 ERROR LazyInitializationException:19 - illegal access to loading collection
org.hibernate.LazyInitializationException: illegal access to loading collection
   at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341)
   at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
   at org.hibernate.collection.PersistentBag.listIterator(PersistentBag.java:422)
   at java.util.AbstractList.equals(AbstractList.java:606)
   at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:267)
   at eiswind.paris.model.bean.ModelObject.firePropertyChange(ModelObject.java:39)
   at eiswind.paris.model.Category.setChildren(Category.java:71)
   at eiswind.paris.model.Category$$BulkBeanByCGLIB$$4853615e.setPropertyValues(<generated>)
   at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValuesWithOptimizer(PojoEntityTuplizer.java:212)
   at ...

Name and version of the database you are using:
Postgres 8
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

[code]


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 12, 2006 5:17 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you should not compare lazy collections
you can know whether a collection is lazy or not by using Hibernate.isInitialize

_________________
Emmanuel


Top
 Profile  
 
 Post subject: JavaBean
PostPosted: Mon Mar 13, 2006 3:18 am 
Beginner
Beginner

Joined: Thu Sep 01, 2005 10:09 am
Posts: 39
That means I can't use the JavaBean PropertyChangeSupport ? I have to grow my own stuff fpr this ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 13, 2006 8:12 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
right unless PropertyChangeSupport has a pluggable strategy

_________________
Emmanuel


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