-->
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.  [ 8 posts ] 
Author Message
 Post subject: MassIndexer gives NonUniqueObjectException
PostPosted: Thu May 27, 2010 8:10 am 
Newbie

Joined: Sun Nov 15, 2009 8:22 pm
Posts: 19
Hi!
Ill try this question first without showing much code, maybe its something someone could give a quick pointer on.

When running the massindexer:

Code:
MassIndexer massIndexer = fullTextSession.createIndexer(Arrangement.class);
massIndexer.startAndWait();


I get a
Quote:
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session


But if I run it with:

Code:
for (Arrangement arr : allArr) {   
      fullTextSession.index(arr);
}


it works out well without any errors reported and correct indexes (I think).

Any ideas?

Thanks!


Top
 Profile  
 
 Post subject: Re: MassIndexer gives NonUniqueObjectException
PostPosted: Thu May 27, 2010 6:11 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
which version of Hibernate Search are you using?

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: MassIndexer gives NonUniqueObjectException
PostPosted: Fri May 28, 2010 8:18 am 
Newbie

Joined: Sun Nov 15, 2009 8:22 pm
Posts: 19
Hi Sanne!
I'm using version 3.2.0 final.


Top
 Profile  
 
 Post subject: Re: MassIndexer gives NonUniqueObjectException
PostPosted: Fri May 28, 2010 8:31 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
ok, 3.2 final should work fine, you must have found something we don't know of.

could you please post the full stacktrace and the Arrangement class? does it have subtypes?

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: MassIndexer gives NonUniqueObjectException
PostPosted: Sat May 29, 2010 5:05 am 
Newbie

Joined: Sun Nov 15, 2009 8:22 pm
Posts: 19
Ok, its a rather big class with alot of embedded classes and it extends a base class with the Id. "Base" is a abstract class.


Code:
@Entity
@Table(name="ON_ARRANGEMENT")
@Indexed
@Analyzer(impl=LocalizedAnalyzer.class)
public class Arrangement extends Base {

   public Arrangement() {}

   @OneToMany(mappedBy="arrangement", cascade=CascadeType.ALL, fetch=FetchType.LAZY)
   @IndexedEmbedded
   public Set<TagRelation> getTags() {
      return tags;
   }
   public void setTags(Set<TagRelation> arrangementtags) {
      this.tags = arrangementtags;
   }
   

   @ManyToMany(targetEntity=Category.class,fetch=FetchType.LAZY)
   @JoinTable(name="ON_ARRANGEMENT_CATEGORY", joinColumns={@JoinColumn(name="arrangement_id")}, inverseJoinColumns={@JoinColumn(name="category_id")})
    @IndexedEmbedded
   public Set<Category> getCategories() {
      return categories;
   }
   public void setCategories(Set<Category> categories) {
      this.categories = categories;
   }


   @ManyToOne(fetch=FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE}, optional=true)
   @IndexedEmbedded
   public Address getAddress() {
      return address;
   }
   public void setAddress(Address address) {
      this.address = address;
   }


   @OneToMany(mappedBy="arrangement", cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    @OrderBy("start ASC")
    @IndexedEmbedded
   public Set<Schedulepart> getSchedule() {
      return schedule;
   }
   public void setSchedule(Set<Schedulepart> schedule) {
      this.schedule = schedule;
   }
   
   
   @ManyToOne(fetch=FetchType.LAZY, optional=true)
   @IndexedEmbedded
   public Organizer getOrganizer() {
      return organizer;
   }
   public void setOrganizer(Organizer organizer) {
      this.organizer = organizer;
   }


   @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
   @OrderBy("language ASC")
    @JoinTable(name="ON_ARRANGEMENT_NAME", joinColumns={@JoinColumn(name="arrangement_id")}, inverseJoinColumns={@JoinColumn(name="text_id")})
    @IndexedEmbedded
   public Set<Text> getNametexts() {
      return nametexts;
   }
   public void setNametexts(Set<Text> nametexts) {
      this.nametexts = nametexts;
   }


   @OneToMany(cascade=CascadeType.ALL,  fetch=FetchType.LAZY)
   @OrderBy("language ASC")
    @JoinTable(name="ON_ARRANGEMENT_SUMMARY", joinColumns={@JoinColumn(name="arrangement_id")}, inverseJoinColumns={@JoinColumn(name="text_id")})
    @IndexedEmbedded
   public Set<Text> getSummarytexts() {
      return summarytexts;
   }
   public void setSummarytexts(Set<Text> summarytexts) {
      this.summarytexts = summarytexts;
   }


   @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
   @OrderBy("language ASC")
    @JoinTable(name="ON_ARRANGEMENT_NOTE", joinColumns={@JoinColumn(name="arrangement_id")},  inverseJoinColumns={@JoinColumn(name="text_id")})
    @IndexedEmbedded
   public Set<Text> getNotetexts() {
      return notetexts;
   }
   public void setNotetexts(Set<Text> notetexts) {
      this.notetexts = notetexts;
   }


   @Override
    public boolean equals(Object other) {
       if ( !(other instanceof Arrangement) ) return false;
       Arrangement castOther = (Arrangement) other;
        return new EqualsBuilder()
            .append(this.getId(), castOther.getId())
            .isEquals();
    }

}





Code:
BBO 10:48:46,955 pt.AbstractSecurityInterceptor  INFO Validated configuration attributes
BBO 10:48:47,069 .FilterChainProxyPostProcessor  INFO Checking sorted filter chain: [org.springframework.security.context.HttpSessionContextIntegrationFilter[ order=200; ], OrderedFilterDecorator[ delegate=org.springframework.security.ui.logout.LogoutFilter[ order=300; ]; order=300], OrderedFilterDecorator[ delegate=com.work.web.security.MyAuthenticationProcessingFilter[ order=700; ]; order=700], org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter[ order=1100; ], OrderedFilterDecorator[ delegate=com.work.web.security.MyRememberMeProcessingFilter[ order=1200; ]; order=1200], org.springframework.security.ui.ExceptionTranslationFilter[ order=1400; ], org.springframework.security.ui.SessionFixationProtectionFilter[ order=1600; ], org.springframework.security.intercept.web.FilterSecurityInterceptor@6c8b7b]
BBO 10:48:47,069 .FilterChainProxyPostProcessor  INFO Filter chain...
BBO 10:48:47,069 .FilterChainProxyPostProcessor  INFO [0] - org.springframework.security.context.HttpSessionContextIntegrationFilter[ order=200; ]
BBO 10:48:47,069 .FilterChainProxyPostProcessor  INFO [1] - org.springframework.security.ui.logout.LogoutFilter[ order=300; ]
BBO 10:48:47,069 .FilterChainProxyPostProcessor  INFO [2] - com.work.web.security.MyAuthenticationProcessingFilter[ order=700; ]
BBO 10:48:47,069 .FilterChainProxyPostProcessor  INFO [3] - org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter[ order=1100; ]
BBO 10:48:47,069 .FilterChainProxyPostProcessor  INFO [4] - com.work.web.security.MyRememberMeProcessingFilter[ order=1200; ]
BBO 10:48:47,069 .FilterChainProxyPostProcessor  INFO [5] - org.springframework.security.ui.ExceptionTranslationFilter[ order=1400; ]
BBO 10:48:47,069 .FilterChainProxyPostProcessor  INFO [6] - org.springframework.security.ui.SessionFixationProtectionFilter[ order=1600; ]
BBO 10:48:47,069 .FilterChainProxyPostProcessor  INFO [7] - org.springframework.security.intercept.web.FilterSecurityInterceptor@6c8b7b
BBO 10:48:47,071 .FilterChainProxyPostProcessor  INFO Checking whether login URL '/signin' is accessible with your configuration
BBO 10:48:47,071 .FilterChainProxyPostProcessor  INFO FilterChainProxy: FilterChainProxy[ UrlMatcher = org.springframework.security.util.AntUrlPathMatcher[requiresLowerCase='true']; Filter Chains: {/=[], /**=[org.springframework.security.context.HttpSessionContextIntegrationFilter[ order=200; ], org.springframework.security.ui.logout.LogoutFilter[ order=300; ], com.work.web.security.MyAuthenticationProcessingFilter[ order=700; ], org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter[ order=1100; ], com.work.web.security.MyRememberMeProcessingFilter[ order=1200; ], org.springframework.security.ui.ExceptionTranslationFilter[ order=1400; ], org.springframework.security.ui.SessionFixationProtectionFilter[ order=1600; ], org.springframework.security.intercept.web.FilterSecurityInterceptor@6c8b7b]}]
BBO 10:48:47,190 sactionalTestExecutionListener  INFO Began transaction (1): transaction manager [org.springframework.orm.hibernate3.HibernateTransactionManager@bd1232]; rollback [false]
BBO 10:48:47,677 .SimpleIndexingProgressMonitor  INFO Going to reindex 3087 entities
BBO 10:48:48,366 tityConsumerLuceneworkProducer ERROR error during batch indexing:
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.work.dao.domain.Arrangement#1323]
   at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:637)
   at org.hibernate.event.def.AbstractReassociateEventListener.reassociate(AbstractReassociateEventListener.java:76)
   at org.hibernate.event.def.DefaultLockEventListener.onLock(DefaultLockEventListener.java:82)
   at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:766)
   at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:758)
   at org.hibernate.impl.SessionImpl.access$500(SessionImpl.java:148)
   at org.hibernate.impl.SessionImpl$LockRequestImpl.lock(SessionImpl.java:2278)
   at org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer.indexAllQueue(EntityConsumerLuceneworkProducer.java:116)
   at org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer.run(EntityConsumerLuceneworkProducer.java:92)
   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:619)
BBO 10:48:48,485 tityConsumerLuceneworkProducer ERROR error during batch indexing:
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.work.dao.domain.Arrangement#1008]
   at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:637)
   at org.hibernate.event.def.AbstractReassociateEventListener.reassociate(AbstractReassociateEventListener.java:76)
   at org.hibernate.event.def.DefaultLockEventListener.onLock(DefaultLockEventListener.java:82)
   at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:766)
   at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:758)
   at org.hibernate.impl.SessionImpl.access$500(SessionImpl.java:148)
   at org.hibernate.impl.SessionImpl$LockRequestImpl.lock(SessionImpl.java:2278)
   at org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer.indexAllQueue(EntityConsumerLuceneworkProducer.java:116)
   at org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer.run(EntityConsumerLuceneworkProducer.java:92)
   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:619)
BBO 10:48:48,764 tityConsumerLuceneworkProducer ERROR error during batch indexing:
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.work.dao.domain.Arrangement#905]
   at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:637)
   at org.hibernate.event.def.AbstractReassociateEventListener.reassociate(AbstractReassociateEventListener.java:76)
   at org.hibernate.event.def.DefaultLockEventListener.onLock(DefaultLockEventListener.java:82)
   at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:766)
   at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:758)
   at org.hibernate.impl.SessionImpl.access$500(SessionImpl.java:148)
   at org.hibernate.impl.SessionImpl$LockRequestImpl.lock(SessionImpl.java:2278)
   at org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer.indexAllQueue(EntityConsumerLuceneworkProducer.java:116)
   at org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer.run(EntityConsumerLuceneworkProducer.java:92)
   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:619)
BBO 10:48:48,888 tityConsumerLuceneworkProducer ERROR error during batch indexing:
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.work.dao.domain.Arrangement#1471]
   at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:637)
   at org.hibernate.event.def.AbstractReassociateEventListener.reassociate(AbstractReassociateEventListener.java:76)
   at org.hibernate.event.def.DefaultLockEventListener.onLock(DefaultLockEventListener.java:82)
   at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:766)
   at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:758)
   at org.hibernate.impl.SessionImpl.access$500(SessionImpl.java:148)
   at org.hibernate.impl.SessionImpl$LockRequestImpl.lock(SessionImpl.java:2278)
   at org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer.indexAllQueue(EntityConsumerLuceneworkProducer.java:116)
   at org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer.run(EntityConsumerLuceneworkProducer.java:92)
   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:619)


Thanks!


Top
 Profile  
 
 Post subject: Re: MassIndexer gives NonUniqueObjectException
PostPosted: Sun May 30, 2010 4:40 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
thanks, I could confirm this issue: HSEARCH-534.
fixing soon, please monitor the issue.

As a workaround, I believe you won't be affected when using a single thread, could you please confirm this?

Code:
fullTextSession.createIndexer( Object.class )
      .threadsForSubsequentFetching( 1 )
      .threadsToLoadObjects( 1 )
      .batchSizeToLoadObjects( 30 )
      .startAndWait();

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: MassIndexer gives NonUniqueObjectException
PostPosted: Wed Jun 02, 2010 9:52 am 
Newbie

Joined: Sun Nov 15, 2009 8:22 pm
Posts: 19
Thanks for the reply and sorry for the delay.
Ok, good.
But no, your workaround doesn't work for me.

Code:
fullTextSession.createIndexer( Arrangement.class )
         .threadsForSubsequentFetching( 1 )
         .threadsToLoadObjects( 1 )
         .batchSizeToLoadObjects( 30 )
         .startAndWait();


Code:
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.work.dao.domain.Arrangement#905]
   at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:637)
   at org.hibernate.event.def.AbstractReassociateEventListener.reassociate(AbstractReassociateEventListener.java:76)
   at org.hibernate.event.def.DefaultLockEventListener.onLock(DefaultLockEventListener.java:82)
   at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:766)
   at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:758)
   at org.hibernate.impl.SessionImpl.access$500(SessionImpl.java:148)
   at org.hibernate.impl.SessionImpl$LockRequestImpl.lock(SessionImpl.java:2278)
   at org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer.indexAllQueue(EntityConsumerLuceneworkProducer.java:116)
   at org.hibernate.search.batchindexing.EntityConsumerLuceneworkProducer.run(EntityConsumerLuceneworkProducer.java:92)
   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:619)


Top
 Profile  
 
 Post subject: Re: MassIndexer gives NonUniqueObjectException
PostPosted: Wed Jun 02, 2010 10:24 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
thanks.
I believe the issue is fixed, but I had to make my own test to reproduce it.
could you checkout and try if it's solved for you?

_________________
Sanne
http://in.relation.to/


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