scravy
scravy

Reputation: 12283

EclipseLink/JPA: Specify length of byte array

I have the following definition:

@Column(name = "password", length = 80)
byte[] password;

When I use EclipseLink to create the tables (mysql) I get a table with a longblob. A tinyblob would suffice.

How do I have to specify the length?

I know that I could add a columnDefinition but I'd like to keep it database/sql agnostic.

Upvotes: 1

Views: 1171

Answers (1)

Mikko Maunu
Mikko Maunu

Reputation: 42114

If you want specific type for blob column, columnDefinition should be used. Problem with length is that it is only for strings. This is also told in API.

Upvotes: 2

Related Questions