While updating our application to Hibernate 5.2.3 we've encountered this issue with primitive property fields annotated with @Basic(fetch = FetchType.LAZY).
@Basic(fetch = FetchType.LAZY)
@Column
@Type(type = "org.hibernate.type.BinaryType")
private byte[] xslData;
In a forked repo I've applied a similar fix to the one in your pull request @Luis Barreiro to the following classes
- hibernate-core/src/main/java/org/hibernate/type/BinaryType.java
- hibernate-core/src/main/java/org/hibernate/type/MaterializedBlobType.java
- hibernate-core/src/main/java/org/hibernate/type/MaterializedClobType.java
- hibernate-core/src/main/java/org/hibernate/type/MaterializedNClobType.java
A better solution may be to have a new class in the hierarchy that handles lazy property fields BinaryType -> extends -> AbstractLazySingleColumnStandardBasicType -> extends -> AbstractSingleColumnStandardBasicType While doing this it would be good to make the BasicType and Type interfaces generic |