[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-1093) Smarter dirty checking with @Transient fields

Sanne Grinovero (JIRA) noreply at atlassian.com
Fri Apr 13 11:28:48 EDT 2012


    [ https://hibernate.onjira.com/browse/HSEARCH-1093?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46283#comment-46283 ] 

Sanne Grinovero commented on HSEARCH-1093:
------------------------------------------

Marc, can you split this in two? It is a good idea to explore possible improvements (I'll have to think a bit on your proposal), but I think opening an issue is higher priority, we should for now at least consider the @Transient field suspicious enough to flag it always dirty, much safer than consider it "not dirty" or we'd risks to be not correct: -> bug.

And, unless you want to try solve it *as well*, you know I'm going to ask for a test ;-)


> 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