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