-->
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: Data truncation: Data too long for column
PostPosted: Wed Jul 05, 2006 9:11 am 
Newbie

Joined: Wed Jul 05, 2006 9:04 am
Posts: 2
I'm using hibernate 3 with mysql server 5.0 on a windows XP. I've set up a simple system where everything runs fine until I add too much (about 200 characters) text to one of the properties. I get the following error:

14:56:05,718 WARN JDBCExceptionReporter:71 - SQL Error: 0, SQLState: 01004
14:56:05,718 ERROR JDBCExceptionReporter:72 - Data truncation: Data too long for column 'text' at row 1
14:56:05,718 ERROR AbstractFlushingEventListener:300 - Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException
(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.j
ava:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp
er.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:
202)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutio
ns(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlus
hEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java
:106)

What happened. How to avoid?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 05, 2006 9:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Data is to long for the database column to store it. SOme database auto-truncate others complain. Two option:
1) Reduce the size/length of the data your storing in the column;
2) Create a custom user type that does the truncation for you. See the manual and the wiki for some pointers and samples.


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.