Uploaded image for project: 'Hibernate ORM'
  1. HHH-11716

@Transient annotation not respected when class defines 'get' and 'is' accessor variants


    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects versions: 4.3.0.Final, 5.0.11, 5.2.7
    • Fix versions: 5.2.11
    • Components: hibernate-core
    • Environment:
      Windows 7, SQL Server 2012
      Red Hat JBoss EAP 6.4.5
      - Hibernate 4.2.21.Final-redhat-1
      Red Hat JBoss EAP 7.0.3
      - Hibernate 5.0.11.Final-redhat-1
      - Hibernate 5.2.7.Final


      I encountered the following while porting our application from JBoss EAP 6.4 (Hibernate 4.2) to EAP 7 (Hibernate 5). It occurred with both EAP's bundled 5.0.11, and when I upgraded the provider to 5.2.7. Sorry, I haven't been able to check whether it still exists as of the current 5.2.10.

      We had a couple of entities with the pattern below:

      package xyz;
      <imports omitted...>
       * An audit of the processing of a data load file, both automatically and manually initiated steps, starting from the
       * discovery of the file and ending with the archiving of the file.
      public class DataLoadFileEvent
          <unrelated members omitted...>
          private Boolean reported;
          public DataLoadFileEvent()
          public void setReported(Boolean reported)
              this.reported = reported;
          public Boolean getReported()
              return this.reported;
          public boolean isReported()
              boolean ret = false;
              if (reported != null)
                  ret = reported;
              return ret;

      Note the convenience method isReported() annotated with @Transient that returns the unwrapped value of the Boolean member. In Hibernate 4.2, isReported() is correctly ignored when the entity is loaded; but under 5.0.11 and 5.2.7 we get the following exception for duplicate accessors:

      org.hibernate.MappingException: In trying to locate getter for property [reported], Class [xyz.DataLoadFileEvent] defined both a `get` [public java.lang.Boolean xyz.DataLoadFileEvent.getReported()] and `is` [public boolean xyz.DataLoadFileEvent.isReported()] variant

      For reference: https://forum.hibernate.org/viewtopic.php?f=1&t=1043982


          Issue links



              • Votes:
                0 Vote for this issue
                4 Start watching this issue


                • Created: