[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-1093) Smarter dirty checking with @Transient fields
Sanne Grinovero (JIRA)
noreply at atlassian.com
Fri Apr 13 11:48:49 EDT 2012
[ https://hibernate.onjira.com/browse/HSEARCH-1093?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46288#comment-46288 ]
Sanne Grinovero commented on HSEARCH-1093:
------------------------------------------
{quote}I suppose from a purist point of view flagging transient as dirty by default is the same as flagging Classbridged class as dirty by default.{quote}
Exactly what we do. I am obviously interested in exploring nice ways to provide this control to user. Still, correctness comes first.
It's a tricky subject, since Search can hardly introspect which fields you're reading from the custom code.. and adding too many options and annotations makes it hard to learn.
{quote}Neither fails to generate a lack of enthusiasm in me{quote}
Great!
> Smarter dirty checking with @Transient fields
> ---------------------------------------------
>
> Key: HSEARCH-1093
> URL: https://hibernate.onjira.com/browse/HSEARCH-1093
> Project: Hibernate Search
> Issue Type: Improvement
> Affects Versions: 4.1.0.Final
> Reporter: Marc Schipperheyn
>
> 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.
> {code}
> @ManyToOne
> @JoinColumn
> @IndexedEmbedded
> public Photo getPhoto() {
> return photo;
> }
> @Transient
> @Field
> public String getMugshot(){
> if(photo == null)
> return null;
> return getUserDirectory() + "/" + photo.getFilename();
> }
> {code}
> This makes sense. However, it's not desirable. I would therefore want to propose an annotation that can add some magic to dirty checking and inform Hibernate Search that when @Field x gets dirty, the @Transient field should also be considered dirty
> Something like
> {code}
> @ManyToOne
> @JoinColumn
> @IndexedEmbedded
> public Photo getPhoto() {
> return photo;
> }
> @Transient
> @Field
> @AssociateDirty(fields={"photo"})
> public String getMugshot(){
> if(photo == null)
> return null;
> return getUserDirectory() + "/" + photo.getFilename();
> }
> {code}
> There are many names one might give to such an annotation. E.g. @YouDirtyMeDirty, but many somehow sound a little "dirty" :-)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list