The bytea type in Postgres does not allow length's to be defined.
Postgres gave strange errors using Types.BLOB rather than Types.LONGVARBINARY. Add configuration to the DatabasePlatform to determine the preferred BLOB type.
These fixes are in HEAD.