-->
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: LazyInitException on nested includePath with Lazy init
PostPosted: Mon Apr 02, 2012 7:53 am 
Pro
Pro

Joined: Wed Nov 05, 2003 7:22 pm
Posts: 211
Hi,

I'm getting

Code:
ERROR LogErrorHandler.handleException(83) | HSEARCH000058: HSEARCH000116: Unexpected error during MassIndexer operation
org.hibernate.search.bridge.BridgeException: Exception while calling bridge#set
        class: nl.project.model.Post
        path: likes.like.user.
  at org.hibernate.search.bridge.util.impl.ContextualExceptionBridgeHelper.buildBridgeException(ContextualExceptionBridgeHelper.java:97)
        at org.hibernate.search.bridge.util.impl.ContextualExceptionBridgeHelper$OneWayConversionContextImpl.set(ContextualExceptionBridgeHelper.java:126)
        at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.buildDocumentFields(DocumentBuilderIndexedEntity.java:501)
        at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.buildDocumentFields(DocumentBuilderIndexedEntity.java:581)
        at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.getDocument(DocumentBuilderIndexedEntity.java:479)
        at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.createAddWork(DocumentBuilderIndexedEntity.java:402)
        at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.index(EntityConsumerLuceneWorkProducer.java:172)
        at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.indexAllQueue(EntityConsumerLuceneWorkProducer.java:132)
        at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.run(EntityConsumerLuceneWorkProducer.java:102)
        at org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.run(OptionallyWrapInJTATransaction.java:112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: nl.project.model.User.roles, no session or session was closed
        at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:393)
        at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:385)
        at org.hibernate.collection.internal.AbstractPersistentCollection.readElementExistence(AbstractPersistentCollection.java:160)


The referenced code is

Code:
public class User{

   @ManyToMany(cascade=CascadeType.MERGE,fetch = FetchType.LAZY)
   @JoinTable(name = "ABC", joinColumns = @JoinColumn(nullable = false), inverseJoinColumns = @JoinColumn(nullable = false))
   @Fetch(FetchMode.SUBSELECT)
   @Cache(usage=CacheConcurrencyStrategy.READ_WRITE,region=CacheRegion.USER)
   @IndexedEmbedded(prefix="role.")
   public Set<UserRole> getRoles() {
      return roles;
   }

public class Post{
   @OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
   @JoinTable(name = "XYZ"
      ,joinColumns=@JoinColumn(name="PId")
      ,inverseJoinColumns=@JoinColumn(name="UId")      
      )
   @BatchSize(size=5)
   @IndexedEmbedded(prefix="like.user.",includePaths={"id","nickName"})
   public Set<User> getLikes() {
      return likes;
   }


I'm using HSearch 4.1CR3

Both User and Post are @Indexed entities and both are using fields with the includePaths property which, as referenced by HSEARCH 1049 can create problems in some cases. I'm wondering if this is causing it.

Any ideas?

Kind regards,
Marc


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.