Hi all,
We are upgrading an application from JBoss EAP 6.4 to the newest EAP 7.0, and along with that comes a move from Hibernate 4.3 to 5. I've come across a couple of behaviours that forced me to make code changes for the newest version, and was wondering whether there are configuration options I've missed, or these are features or even bugs in the latest releases?
Here's our platform:
- JBoss 7.0.3 (soon 7.0.4)
- Hibernate Core 5.0.11.Final-redhat-1 -> upgraded to Hibernate Core 5.2.7.Final
- Hibernate Validator 5.2.4.Final-redhat-1 -> upgraded to Hibernate Validator 5.4.0.Final
- Hibernate Commons Annotations {5.0.1.Final-redhat-2}
- Microsoft SQL Server 2012
I had to upgrade Hibernate Core for
HHH-10978 (even though that bug was reportedly fixed in 5.0.11, I still encountered it; happily deploying 5.2.7 fixed it). I've also upgraded Hibernate Validator to see if it made a difference to my issues below, but as there was no change we probably won't deploy this when the setup is migrated to other environments.
Number 1: We had a couple of entity classes like this:
Code:
package xxx;
<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 getReported() accessor returning the member (big-B) Boolean, and the convenience method isReported() that returns the unwrapped (small-b) boolean value. This code
worked in Hibernate 4.3, but under 5.0.11 and 5.2.7 throws the following exception:
Quote:
org.hibernate.MappingException: In trying to locate getter for property [reported], Class [xxx.DataLoadFileEvent] defined both a `get` [public java.lang.Boolean xxx.DataLoadFileEvent.getReported()] and `is` [public boolean xxx.DataLoadFileEvent.isReported()] variant
However, isReported() is marked with the @Transient annotation, so it should be ignored, should it not?
(I can concede it's maybe not great class design, and it isn't a breaking code change for us as there were only three instances that either weren't referenced or that I could refactor - but I'm still puzzled as to why it isn't allowed with @Transient in version 5.)
Number 2: We had many entity classes with an @Entity or @Table annotation specifying a name or schema that did not match the capitalisation of the table in the database, for example:
Code:
@Entity(name="appDefect")
public class ApplicationDefect
where the table is named AppDefect. This all worked in
4.3 and 5.0.11, but
not in 5.2.7, which complained about table not found. When the capitalization was corrected, it worked, but as this changed spontaneously between minor versions I'm wondering whether it was intentional and if there is a configuration setting to make it case-insensitive again?
(Again, not a breaking code change but I had to edit around 60 entities to get it to run again.)
Thanks in advance for any advice or explanations.