-->
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: Data too long for column exception in hibernet.
PostPosted: Sat Jul 30, 2011 4:37 am 
Newbie

Joined: Sat Jul 30, 2011 3:14 am
Posts: 5
I am getting a data too large problem in hibernate. that is-

Quote:
org.hibernate.exception.DataException: could not insert: [dao.Address]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:75)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:1986)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2405)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:37)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:269)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:557)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:545)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:541)
at testhibernet.AccessProgram.saveAddress(AccessProgram.java:27)
at testhibernet.AddressGUI.insertbtActionPerformed(AddressGUI.java:105)
at testhibernet.AddressGUI.access$000(AddressGUI.java:20)
at testhibernet.AddressGUI$1.actionPerformed(AddressGUI.java:75)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2013)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2336)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:260)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:254)
at java.awt.Component.processMouseEvent(Component.java:6100)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3288)
at java.awt.Component.processEvent(Component.java:5865)
at java.awt.Container.processEvent(Container.java:2099)
at java.awt.Component.dispatchEventImpl(Component.java:4461)
at java.awt.Container.dispatchEventImpl(Container.java:2157)
at java.awt.Component.dispatchEvent(Component.java:4287)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4455)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4119)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4049)
at java.awt.Container.dispatchEventImpl(Container.java:2143)
at java.awt.Window.dispatchEventImpl(Window.java:2555)
at java.awt.Component.dispatchEvent(Component.java:4287)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:605)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:276)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:191)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:186)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:139)
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'FBZip' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3359)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3295)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1852)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1975)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2476)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1583)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1859)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1777)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1762)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:1968)
... 43 more


Is it possible automatic truncate all field's data or any other way to handle this problem.
But I does not want to check all field's data length because I have more then thousand of fields.


Last edited by khoyendra on Sun Jul 31, 2011 11:57 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Data too long for column exception in hibernet.
PostPosted: Sun Jul 31, 2011 2:05 pm 
Newbie

Joined: Sat Mar 26, 2011 8:57 am
Posts: 6
What kind of database are you using. I think most database-engines will automatically strip the length of a string to the maximum size. If your database won't do this, you are maybe able to configure this inside you db-engine??


Top
 Profile  
 
 Post subject: Re: Data too long for column exception in hibernet.
PostPosted: Sun Jul 31, 2011 11:10 pm 
Newbie

Joined: Sat Jul 30, 2011 3:14 am
Posts: 5
I am using MySql 5.1..41 database and hibernate3.jar.
If I goes to insert data with simple query then its automatically truncate but when I goes to insert this same data with hibernate then its not working.
Quote:
you are maybe able to configure this inside you db-engine??


what configure I need to do in my db-engine?.


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.