-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: question: blob versus longblob with SchemaExport and MySQL
PostPosted: Tue Dec 14, 2004 10:24 am 
Newbie

Joined: Fri Feb 20, 2004 7:37 am
Posts: 12
Hibernate version:
2.1.7b

Hi,

I'm using a user type BinaryBlobType to map a blob to a byte[] (as described in http://www.hibernate.org/73.html) and SchemaExport to generate the DDL.

Everything is fine for MS SQL Server - SchemaExport creates an
Code:
image
column for the blob field which has a maximum size of 2GB.

Under MySQL the SchemaExport generates the datatype
Code:
blob
which has a maximum size of only 64KB.
MySQL differentiates between blob (64KB), mediumblob (16MB) and longblob (4GB).

I have seen that the SchemaExport XML-attribute "sql-type" allows overriding of the automatic datatype detection - but I really don't like that.

Shouldn't be
Code:
longblob
the default blob datatype under MySQL? I mean - a blob with a 64KB limit is more a "bob" than a "blob". ;-)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 14, 2004 11:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You can write a simple custom Dialect to change that.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 14, 2004 6:31 pm 
Regular
Regular

Joined: Tue Sep 28, 2004 6:34 pm
Posts: 50
CLOB becomes TEXT 64k but you can define length="16777215" to make it MEDIUMTEXT - I guess you can do the same for blobs:)

Lukasz


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 14, 2004 7:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote from MySQLDialect.java:

Code:
      registerColumnType( Types.VARBINARY, "longblob" );
      registerColumnType( Types.VARBINARY, 16777215, "mediumblob" );
      registerColumnType( Types.VARBINARY, 65535, "blob" );
      registerColumnType( Types.VARBINARY, 255, "tinyblob" );



Sometimes, it can be worth checking the code ;-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.