-->
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.  [ 2 posts ] 
Author Message
 Post subject: Persisting java.lang.Number in tinyblob
PostPosted: Wed Jan 30, 2013 4:03 am 
Newbie

Joined: Wed Jan 30, 2013 3:51 am
Posts: 2
I am in the process of migrating from JBoss 4.2.2 with Hibernate 3 to JBoss 7 with Hibernate 4.
I use MySQL 5

The following code used to work:
Code:
@Column
public Number getTimezone() {
   return latitude;
}


where the column type is TINYBLOB

but now I get the error:
    Caused by: org.hibernate.exception.DataException: Data truncation: Data too long for column 'timezone' at row 1
    Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'timezone' at row 1

Does anyone know how to avoid this error?


Top
 Profile  
 
 Post subject: Re: Persisting java.lang.Number in tinyblob
PostPosted: Mon Feb 04, 2013 4:04 am 
Newbie

Joined: Wed Jan 30, 2013 3:51 am
Posts: 2
As a workaround I am converting all my TINYBLOB fields to BLOB and annotating all my Number fields with:
Code:
@Column(columnDefinition="blob")


This problem certainly seems to be a bug in hibernate as it by default chooses a field type which does not work - although it might have been caused by a change in the MySQL driver (I am now using mysql-connector-java-5.1.22-bin.jar).


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