Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » @Lob @Column (length=16777215) doesn't work with MySql to get a MEDIUMBLOB
@Lob @Column (length=16777215) doesn't work with MySql to get a MEDIUMBLOB [message #388441] Fri, 29 May 2009 09:46 Go to next message
Martin Dames is currently offline Martin DamesFriend
Messages: 28
Registered: July 2009
Junior Member
Hi guys,

I have a simple Table where one column should be from type LOB. I want to
store some picture data.
When Im connecting to MySQL with EclipseLink (JPA), it creates the tables
automatically and set the right column type for MySQL. But it just creates
columns from type BLOB (which is limited to 64kb in MySQL) and not
MEDIUMBLOB (which would be sufficient for my images).

One solution I found is to set the column length to a size greater than
64kb (see example below) so that EclipseLink (JPA) would create a column
from type MEDIUMBLOB if it is connected to MySQL automatically. This
doesn't work... it just creates columns from type BLOB, doesn't matter
which length im defining for the column.

I triple checked if the tables are being created by JPA, old and not
dropped tables are not the error.

Is this a bug? Thank you.

My annotated entity attribute:
@Column (length=16777215, name="IMAGE") // length for mysql mediumblob
private byte[] mymage;
Re: @Lob @Column (length=16777215) doesn't work with MySql to get a MEDIUMBLOB [message #388478 is a reply to message #388441] Mon, 01 June 2009 03:26 Go to previous message
Doug Clarke is currently offline Doug ClarkeFriend
Messages: 155
Registered: July 2009
Senior Member
If you ever need to customize the types used in the schema generation you
can use the columnDefinition attribute of the @Column annotation. This
allows you to specify the exact string that will be used.

private byte[] image;

Previous Topic:List of Supertype and @OrderBy
Next Topic:EclipseLink does not store in database
Goto Forum:

Current Time: Tue Apr 07 14:37:35 GMT 2020

Powered by FUDForum. Page generated in 0.01367 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top