-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem with TEXT field in MYSQL 5.0 and strange characters
PostPosted: Wed Oct 25, 2006 10:52 am 
Newbie

Joined: Sun Oct 22, 2006 1:56 pm
Posts: 5
Everything works fine, but using any text field in MYSQL 5.0, with MYSQLInnoDBDialect, when I try to insert a string with strange characters ("áéñÇç...") it fails. It doesn't matter how long the String is; it only fails with strange characters.
I am using utf-8 for java files and utf-8 in MYSQL Database.

Hibernate version:
3.2 GA
Mapping documents:
Using annotations:

Code:
   @Column(name = "Contenido", unique = false, nullable = false, insertable = true, updatable = true)
   @Type (type="text")
   public String getContenido() {
      return this.contenido;
   }

   public void setContenido(String contenido) {
      this.contenido = contenido;
   }



Full stack trace of any exception that occurs:
Code:
2006-10-25 16:42:03,070 [main] ERROR org.hibernate.util.JDBCExceptionReporter(72) - Data truncation: Data too long for column 'Contenido' at row 1
Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not insert: [es.csa.ubu.paninfo.modelo.Noticia]
   at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:641)
   at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
   at es.csa.ubu.paninfo.negocio.Main.main(Main.java:57)
Caused by: org.hibernate.exception.GenericJDBCException: could not insert: [es.csa.ubu.paninfo.modelo.Noticia]
   at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:40)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2093)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2573)
   at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:47)
   at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
   at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
   at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
   at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
   at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
   at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
   at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
   ... 1 more
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'Contenido' at row 1
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2868)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
   at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1160)
   at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:685)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1400)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1314)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1299)
   at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:73)
   at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:33)
   ... 15 more


Name and version of the database you are using:
MySQL 5.0


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.