-->
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: Unable to insert byte[] in my MySQL
PostPosted: Thu Jun 02, 2016 12:31 pm 
Newbie

Joined: Thu May 22, 2014 2:26 am
Posts: 3
Hi,
I am getting below error when i am trying to insert data

Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'info' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3489)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2019)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1937)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1922)

my entity bean look like below
Code:
@Entity
@Table(name = "mytable")
public class MyTable{
private byte[]                     info        = null;
@Basic(fetch = FetchType.LAZY)
   @Column(name = "info", nullable = false)
   public byte[] getInfo() {
}
}


Code:
describe mytable;
+---------------+--------------+------+-----+---------+----------------+
| Field         | Type         | Null | Key | Default | Extra          |
+---------------+--------------+------+-----+---------+----------------+
| id            | int(11)        | NO   | PRI | NULL    | auto_increment |
| info         | mediumblob  | NO   |       | NULL    |                |
+---------------+--------------+------+-----+---------+----------------+




i am getting same error even after changing mediumblob to largeblob

and the lenght of my info byte[] is arount 1400

i am not able to understand why i am unable to insert 1400 byte in mediumblob or largeblob.

could you please help me on this issue.


thanks in advance

Regards,
Chakri


Top
 Profile  
 
 Post subject: Re: Unable to insert byte[] in my MySQL
PostPosted: Fri Jun 03, 2016 2:31 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Maybe there is an issue with your current MySQL driver. Try using a different version and see how it goes.


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.