Here a demonstration (and explanation) of your problem:
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(new DateTime());
oos.close();
System.out.println("Serialized size: " + bos.toByteArray().length); // output: 273
So a DateTime
-object needs 273 bytes when serialized to a byte array. And since the column type does accept byte-arrays, but is configured to only accept as maximum 255 bytes, you get the SQL-exception. There is only one way to solve the problem if you want to keep JodaTime and the byte-array-storage-mechanism: Increase the column size to at least 273 (needs editing of persistence.xml
).
EDIT: Is it possible for you to reconsider the storage mechanism? The column type VARBINARY seems not to be the best choice because of its size (and you cannot even apply comparing operators in SQL on this type). Alternatives are VARCHAR (but only in ISO-8601-notation please) or SQL-TIMESTAMP. Watch especially for this Joda-Hibernate-support in order to use Type-annotations and better column types.