I am trying to merge an object which has 4 properties (ID, FIRSTNAME, LASTNAME, SCORE) using JPA as ORM and MySQL as RDBMS and I am updating only score for a particular ID and getting following exception.
08:53:23,521 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (Thread-35) SQL Error: 1366, SQLState: HY000
08:53:23,521 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (Thread-35) Incorrect string value: '\xEF\xBF\xBD' for column 'FIRSTNAME' at row 1
08:53:23,527 INFO [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] (Thread-35) HHH00010:On release of batch it still contained JDBC statements
08:53:23,527 ERROR [stderr] (Thread-35) org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [n/a]; SQL state [HY000]; error code [1366]; Incorrect string value: '\xEF\xBF\xBD' for column 'FIRSTNAME' at row 1; nested exception is org.hibernate.exception.GenericJDBCException: Incorrect string value: '\xEF\xBF\xBD' for column 'FIRSTNAME' at row 1
08:53:23,528 ERROR [stderr] (Thread-35) at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:645)
08:53:23,528 ERROR [stderr] (Thread-35) at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:102)
08:53:23,528 ERROR [stderr] (Thread-35) at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:471)
08:53:23,528 ERROR [stderr] (Thread-35) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
How can I get rid of this problem? Thanks!
EDIT Table Collation is utf8_general_ci
0xEF 0xBF 0xBDis the UTF-8 encoded form for the U+FFFD codepoint. This occurs when a UTF-8 parser is unable to parse the sequence of bytes as a valid UTF-8 sequence.From your error, it looks like Hibernate is being provided with this invalid sequence. You’ll therefore need to determine if a data processing element in your stack is parsing data with an incorrect encoding.