-->
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: Transient field not reindexed: underlying field change
PostPosted: Fri Apr 06, 2012 12:06 pm 
Pro
Pro

Joined: Wed Nov 05, 2003 7:22 pm
Posts: 211
I found that if you have a field that is @Transient and depends on a Hibernate managed field, this field is not updated when the underlying field changes. Can't say exactly yet if it's in all cases. Using HSearch 4.1.0.Final

Code:
   @ManyToOne(cascade = CascadeType.ALL,fetch=FetchType.EAGER)
   @JoinColumn
   @IndexedEmbedded
   public Photo getPhoto() {
      return photo;
   }

   @Transient
   @Field(index=Index.NO,store=Store.YES)
   public String getMugshot(){
      if(photo == null)
         return null;
      return getUserDirectory() + "/" + photo.getFilename();
   }



I saw this behaviour when creating the user, saving and flushing and then adding a photo and resaving, all in one process.

I assume that the dirty checking mechanism is responsible for this.

Any ideas how to deal with this?

Marc


Top
 Profile  
 
 Post subject: Re: Transient field not reindexed: underlying field change
PostPosted: Sat Apr 07, 2012 11:20 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi Marc,
right I don't think we have a test using dirty checking on @Transient fields. Will you make a unit test?

To work around it, you' ll need to disable the dirty checking optimisations.
Code:
hibernate.search.​enable_dirty_check = false


Please open a JIRA!

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


Top
 Profile  
 
 Post subject: Re: Transient field not reindexed: underlying field change
PostPosted: Tue Apr 10, 2012 2:19 pm 
Pro
Pro

Joined: Wed Nov 05, 2003 7:22 pm
Posts: 211
Right, well disabling dirty checking is something I want to avoid and it makes sense that Hibernate doesn't somehow magically knows that a Transient @Field is dependent on a managed @Field. I'll open a Jira suggesting a tag to create this magic.

https://hibernate.onjira.com/browse/HSEARCH-1093


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.