It’s actually very simple.
Since version 2.10.1, you can use the MySQLBinaryType
from the Hibernate Types project, so your mapping looks like this:
@Entity
@TypeDef(
typeClass = MySQLBinaryType.class,
defaultForType = byte[].class
)
public class Post {
@Id
@GeneratedValue
private Long id;
private String title;
@Column
private byte[] image;
...
}
Here you can see an example on GitHub that works like a charm.