-->
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.  [ 1 post ] 
Author Message
 Post subject: Lazy loading exception during serialization
PostPosted: Tue Jan 05, 2010 9:27 am 
Beginner
Beginner

Joined: Wed Jul 30, 2008 8:43 am
Posts: 32
Hi.

I have the web app on Tomcat. On context reloadings since some time I see the lazy loading exception during serialization of the session:

Code:
15:58:43,828 ERROR LazyInitializationException:42 - failed to lazily initialize a collection of role: com.consult.alto.entity.Order.coWorkers, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.consult.alto.entity.Order.coWorkers, no session or session was closed
   at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380)
   at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372)
   at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:365)
   at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
   at org.hibernate.collection.PersistentBag.toString(PersistentBag.java:506)
   at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1379)


I see, that is comes from PersistentBag.toString() method. Is this ok, that it is called during serialization of the object and tries to initialize the collection lazily?

Here is the piece of entity class:

Code:
public class Order extends CommonProperties implements Comparable<Order>, Serializable {
    @ManyToMany(fetch = FetchType.LAZY)
    @LazyCollection(LazyCollectionOption.TRUE)
    @JoinTable(name = "Order_employee", joinColumns = @JoinColumn(name = "order_id"), inverseJoinColumns = @JoinColumn(name = "employee_id"))
    private List<Employee> coWorkers = new ArrayList<Employee>();


Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.