| 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.
*/
@Entity
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;
}
@Transient
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 |