I am attempting to persist objects that contain some large Serializable
types. 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 persisting these types is tinyblob
. Unfortunately, this causes crashes when attempting to persist my class, because these types will not fit within the length of tinyblob
.
However, if I manually set the type (using @Column(columnDefinition="longblob")
, or more portably @Column(length=500000)
), it works fine. Is there any way to make the default binary type longblob
instead of tinyblob
, so that I don't need to manually specify the @Column
annotation on 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
{
// MANY Fields
}
EDIT
Since there seems to be some confusion: annotating each field with @Column(columnDefinition="longblob")
(or more portably: @Column(length=500000)
), already works. I am looking for a solution that does not require me to annotate each and every field.