I am trying to save objects containing several large types of Serializable . I want Hibernate to automatically generate my DDL (using Hibernate annotations). For the most part, this works, but the default database column type used by Hibernate when saving these types is tinyblob . Unfortunately, this crashes when trying to save my class, because these types will not match the tinyblob length.
However, if I manually configure the type (using @Column(columnDefinition="longblob") or the more portable @Column(length=500000) ), it works fine. Is there a way to make the default binary type longblob instead of tinyblob , so I donβt have to manually specify the @Column annotation for each field?
ExampleClass.java:
public class ExampleClass { @Column(columnDefinition="longblob") ExampleSerializable ser1; @Column(columnDefinition="longblob") ExampleSerializable ser2; ... }
ExampleSerializable.java:
public class ExampleSerializable implements java.io.Serializable {
EDIT
Since there is some confusion: annotating each field with @Column(columnDefinition="longblob") (or more portable: @Column(length=500000) ) already works. I am looking for a solution that does not require me to annotate each field.
source share