-->
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.  [ 3 posts ] 
Author Message
 Post subject: Large byte[] on mySQL
PostPosted: Thu May 12, 2005 10:42 pm 
Beginner
Beginner

Joined: Wed Apr 13, 2005 2:03 pm
Posts: 34
Hibernate 3.0
mySQL 4.1.10

I have a class, attachment, mapped as follows:

<hibernate-mapping>
<class name="attachment.Attachment" table="attachment">
<id name="id" type="string" length="32">
<column name="id" length="32" not-null="true"/>
<generator class="uuid.hex"/>
</id>
<property name="fileName" column="filename" type="string"/>
<property name="objectClass" column="objectclass" type="string"/>
<property name="objectId" column="object_id" type="string" length="32" />
<property name="data" column="data" type="binary" length="100000000" />
</class>
</hibernate-mapping>

On the back end I have a mySQL table where the 'data' column is a longblob (maximum length on the DB of 4294967295).

When I save attachments with "small" data chunks, it works fine.
When I try to save anything with a large (> 1M) data[] though, I get this error from the mysql driver:

Packet for query is too large (3223606 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable.

Am I going to have to manually "chunk" my data in order to make it work on mySQL? Or is there some sort of workaround inside of Hibernate I can use to make it handle really big byte[]'s without throwing a curveball to mysql?


Top
 Profile  
 
 Post subject: no solution but you helped solved my problem
PostPosted: Fri Jul 08, 2005 8:04 am 
Newbie

Joined: Fri Jul 08, 2005 8:01 am
Posts: 1
i am a very new newbie (clocking up over four hours of hibernate usage!) and though i don't have an answer to your problem ii worked out why my byte[]s weren't getting persisted!

[code]type="binary"[/code]

with no length defaults to length 255, and numerous deserialization errors.

best of luck with your problem at least.

mat


Top
 Profile  
 
 Post subject: Re: Large byte[] on mySQL
PostPosted: Fri Jul 08, 2005 9:17 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
pcasey wrote:
...
...
On the back end I have a mySQL table where the 'data' column is a longblob (maximum length on the DB of 4294967295).

When I save attachments with "small" data chunks, it works fine.
When I try to save anything with a large (> 1M) data[] though, I get this error from the mysql driver:

Packet for query is too large (3223606 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable.

Am I going to have to manually "chunk" my data in order to make it work on mySQL? Or is there some sort of workaround inside of Hibernate I can use to make it handle really big byte[]'s without throwing a curveball to mysql?


When I read your error message, it sounds quite clear to me what you need to do. "You can change this value on the server by setting the max_allowed_packet variable."

This isn't an issue with Hibernate. It's a MySQL issue.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.