Hibernate 3.3.2.GA
MySQL 5.5
Java 6 Update 20
I've been using Hibernate for some time, but haven't seen anything like this before. I have a JUnit test case that saves a relatively complex data structure. When I use a debugger, everything works fine. It even works fine if I don't set any break points and let it run straight through. But when I run the test case without debugging, this one particular string ("category_value" in the stack trace) ends up garbled...or encoded funny...or something.
Any idea what could cause this behavior? Any help appreciated...I don't even know where to begin attacking this problem.
As you can see, I did put a debug statement in Category.setValue(value) and getValue(). It appears the value is being set/retrieved fine...
Neal
MySQL log WHEN debugging (works fine...note string 'moe' in values):
Code:
227 Query insert into category (category_value, code_space, constraint_pattern, constraint_tokens, process_component_id) values ('moe', '', null, 'larry,moe,curly', 8)
MySQL log WHEN NOT debugging (note 'moe' has been replaced with x'ACED00057400036D6F65'):
Quote:
225 Query insert into category (category_value, code_space, constraint_pattern, constraint_tokens, process_component_id) values (x'ACED00057400036D6F65', '', null, 'larry,moe,curly', 7)
Java log WHEN NOT debugging:
Code:
2010-08-19 13:09:26,419 DEBUG [main] (Category.java:67): com.myco.data.Category - +++++++++++ Category.setValue() == moe
2010-08-19 13:09:26,435 DEBUG [main] (Category.java:67): com.myco.data.Category - +++++++++++ Category.getValue() == moe
2010-08-19 13:09:26,437 DEBUG [main] (SQLStatementLogger.java:111): org.hibernate.SQL - insert into data_type (process_component_id) values (?)
2010-08-19 13:09:26,438 DEBUG [main] (SQLStatementLogger.java:111): org.hibernate.SQL - insert into category (category_value, code_space, constraint_pattern, constraint_tokens, process_component_id) values (?, ?, ?, ?, ?)
2010-08-19 13:09:26,446 WARN [main] (JDBCExceptionReporter.java:100): org.hibernate.util.JDBCExceptionReporter - SQL Error: 1366, SQLState: HY000
2010-08-19 13:09:26,447 ERROR [main] (JDBCExceptionReporter.java:101): org.hibernate.util.JDBCExceptionReporter - Incorrect string value: '\xAC\xED\x00\x05t\x00...' for column 'category_value' at row 1
2010-08-19 13:09:26,448 ERROR [main] (AbstractFlushingEventListener.java:324): org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not insert: [com.myco.data.Category]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2285)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2678)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:64)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:997)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1142)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835)
at com.myco.data.HibernateBaseDao.findUniqueByQuery(HibernateBaseDao.java:62)