I am struggling with this problem :
org.hibernate.PropertyAccessException: could not set a field value by reflection setter of fr.mypackage.MyClass.data
Caused by: java.lang.IllegalArgumentException: Can not set [B field fr.mypackage.MyClass.data to java.lang.String
The problem above is about MyClass which is an entity with two attributes :
@Entity
@Table(name = "TG_CLASS")
public class MyClass {
@Id
@Column(name = "ID")
private long id;
@Lob
@Type(type = "org.hibernate.type.TextType")
@Column(name = "DATA")
private byte[] data;
...
}
It looks pretty simple, the only tricky thing is the column DATA which is a bytea (I am working in PostgreSQL), and that the problem comes from Hibernate struggling with converting bytea to String. How can I resolve this problem ?