Reputation: 30156
I'm trying to set the type of a column in OpenJPA as binary(5) so I'm using the following declaration:
@Column(name="MY_FIELD", columnDefinition="BINARY(5)")
public byte[] getMyField() {
return myField;
}
However, the column is always created as a blob:
| MY_FIELD | blob | YES | | NULL | |
Any clues on getting this to work?
Upvotes: 2
Views: 4633
Reputation: 18974
This is a bug in OpenJPA, introduced by OPENJPA-740. I've opened a bug report on your behalf: OPENJPA-1870.
Upvotes: 2
Reputation: 1035
The Hibernate doc says the @Lob annotation is to be used :
@Lob indicates that the property should be persisted in a Blob or a Clob depending on the property type: java.sql.Clob, Character[], char[] and java.lang.String will be persisted in a Clob. java.sql.Blob, Byte[], byte[] and serializable type will be persisted in a Blob.
It works nicely with Hibernate: it should be ok for you with OpenJPA, since the documentation says @Lob is handled "in a standard JPA manner".
Upvotes: -1