-->
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.  [ 2 posts ] 
Author Message
 Post subject: Re-index entity with @Formula field
PostPosted: Mon Mar 07, 2011 6:01 am 
Newbie

Joined: Mon Aug 31, 2009 6:46 am
Posts: 11
Hi,

I have an Entity that has a field that is indexed. The field uses an @Formula annotation to derive its value. How can I get Hibernate Search/Lucene to re-evaluate this formula on the Entity with the new value when I update the entity?

Thanks in advance,

Kevin.


Top
 Profile  
 
 Post subject: Re: Re-index entity with @Formula field
PostPosted: Tue Mar 08, 2011 8:28 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
the formula is evaluated by your database, so the new values aren't available to Search in time (technically it should reload the entity and re-index it).

Assuming you can implement your formula in Java as well, you can add an additional getter which does the math, and annotate it with both @Field (to have it inserted in the index) and @Transient (to have it ignored by Hibernate Core: Search won't ignore it)

_________________
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.  [ 2 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.