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

Marc Schipperheyn (JIRA) noreply at atlassian.com
Tue Apr 10 14:17:51 EDT 2012


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