While updating my application to use all utf8 characters i've run into a strange problem. I can save, get, manipulate, log in full UTF8 mode. The only query i'm having a problem with is getting a list of tutor transactions (we have a database of log files from students working through educational computer tutors).
The one i'm having a spefic problem with is in my chinese dataset. I can see in the Database that the data is being stored correctly, i can bring up a list of the tutor problems one of which has the name "了".
Now when i go to query a list of tutor transactions under this tutor problem i get nothing back from hibernate. I can run the below SQL directly on my database and it works w/o a hitch using the same JDBC connector. I can take the HQL query, copy and paste it into my hibernate tools eclipse plug-in (which is attached to the same DB using the same JDBC) and get results back. Only when i run it in Tomcat within the Spring Framework through my Dao do i get nothing back and for the life of me i can't figure out why. The below logs show that the query seems to be being built and excuted fine (regardless of Spring and Tomcat), but the "done processing result set (0 rows)" followed by "about to close ResultSet (open ResultSets: 1, globally: 1)" makes me most confused. I can run the exact same code on a tutor problem name that doesn't contain non-ascii chars and it excutes correctly. If anyone has any insight as too what exactly i'm missing that would cause me to not get any results back i would be most appreciative.
Hibernate version: 3.1.3
Mapping documents: Spring applicationContext.xml (can provide)
Code between sessionFactory.openSession() and session.close():
Using a Spring Framework Dao.... so just
Code:
results = getHibernateTemplate().find(query);
Full stack trace of any exception that occurs: (no exception)
Name and version of the database you are using: MySQl 5.0.22
JDBC connector :: mysql-connector-java-3.1.13-bin.jar
The generated SQL (show_sql=true): (see log below)
Debug level Hibernate log excerpt: Code:
DEBUG: [http-8080-Processor23] org.hibernate.hql.ast.QueryTranslatorImpl 31 Jul 2006 14:21:05,349 - HQL: select trans.transactionTime, prob.problemName from edu.cmu.pslc.datashop.item.DatasetItem dat join dat.datasetLevels lev join lev.problems prob join prob.subgoals sub join sub.transactions trans join trans.session sess where dat.id = 1 and prob.problemName = '了'
DEBUG: [http-8080-Processor23] org.hibernate.hql.ast.QueryTranslatorImpl 31 Jul 2006 14:21:05,349 - SQL: select transactio4_.transaction_time as col_0_0_, problems2_.problem_name as col_1_0_ from ds_dataset datasetite0_ inner join dataset_level datasetlev1_ on datasetite0_.dataset_id=datasetlev1_.dataset_id inner join problem problems2_ on datasetlev1_.dataset_level_id=problems2_.dataset_level_id inner join subgoal subgoals3_ on problems2_.problem_id=subgoals3_.problem_id inner join tutor_transaction transactio4_ on subgoals3_.subgoal_id=transactio4_.subgoal_id inner join session sessionite5_ on transactio4_.session_id=sessionite5_.session_id where datasetite0_.dataset_id=1 and problems2_.problem_name='了'
DEBUG: [http-8080-Processor23] org.hibernate.hql.ast.ErrorCounter 31 Jul 2006 14:21:05,349 - throwQueryException() : no errors
DEBUG: [http-8080-Processor23] org.hibernate.engine.query.HQLQueryPlan 31 Jul 2006 14:21:05,349 - HQL param location recognition took 0 mills (select trans.transactionTime, prob.problemName from edu.cmu.pslc.datashop.item.DatasetItem dat join dat.datasetLevels lev join lev.problems prob join prob.subgoals sub join sub.transactions trans join trans.session sess where dat.id = 1 and prob.problemName = '了' )
DEBUG: [http-8080-Processor23] org.springframework.transaction.support.TransactionSynchronizationManager 31 Jul 2006 14:21:05,349 - Retrieved value [org.springframework.orm.hibernate3.SessionHolder@15c1ae3] for key [org.hibernate.impl.SessionFactoryImpl@9830bc] bound to thread [http-8080-Processor23]
DEBUG: [http-8080-Processor23] org.hibernate.engine.query.QueryPlanCache 31 Jul 2006 14:21:05,349 - located HQL query plan in cache (select trans.transactionTime, prob.problemName from edu.cmu.pslc.datashop.item.DatasetItem dat join dat.datasetLevels lev join lev.problems prob join prob.subgoals sub join sub.transactions trans join trans.session sess where dat.id = 1 and prob.problemName = '了' )
DEBUG: [http-8080-Processor23] org.hibernate.engine.query.HQLQueryPlan 31 Jul 2006 14:21:05,349 - find: select trans.transactionTime, prob.problemName from edu.cmu.pslc.datashop.item.DatasetItem dat join dat.datasetLevels lev join lev.problems prob join prob.subgoals sub join sub.transactions trans join trans.session sess where dat.id = 1 and prob.problemName = '了'
DEBUG: [http-8080-Processor23] org.hibernate.engine.QueryParameters 31 Jul 2006 14:21:05,349 - named parameters: {}
DEBUG: [http-8080-Processor23] org.hibernate.jdbc.AbstractBatcher 31 Jul 2006 14:21:05,349 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG: [http-8080-Processor23] org.hibernate.SQL 31 Jul 2006 14:21:05,349 - select transactio4_.transaction_time as col_0_0_, problems2_.problem_name as col_1_0_ from ds_dataset datasetite0_ inner join dataset_level datasetlev1_ on datasetite0_.dataset_id=datasetlev1_.dataset_id inner join problem problems2_ on datasetlev1_.dataset_level_id=problems2_.dataset_level_id inner join subgoal subgoals3_ on problems2_.problem_id=subgoals3_.problem_id inner join tutor_transaction transactio4_ on subgoals3_.subgoal_id=transactio4_.subgoal_id inner join session sessionite5_ on transactio4_.session_id=sessionite5_.session_id where datasetite0_.dataset_id=1 and problems2_.problem_name='了'
DEBUG: [http-8080-Processor23] org.hibernate.jdbc.AbstractBatcher 31 Jul 2006 14:21:05,349 - preparing statement
DEBUG: [http-8080-Processor23] org.hibernate.jdbc.AbstractBatcher 31 Jul 2006 14:21:05,349 - about to open ResultSet (open ResultSets: 0, globally: 0)
DEBUG: [http-8080-Processor23] org.hibernate.loader.Loader 31 Jul 2006 14:21:05,349 - processing result set
DEBUG: [http-8080-Processor23] org.hibernate.loader.Loader 31 Jul 2006 14:21:05,349 - done processing result set (0 rows)
DEBUG: [http-8080-Processor23] org.hibernate.jdbc.AbstractBatcher 31 Jul 2006 14:21:05,349 - about to close ResultSet (open ResultSets: 1, globally: 1)
DEBUG: [http-8080-Processor23] org.hibernate.jdbc.AbstractBatcher 31 Jul 2006 14:21:05,349 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG: [http-8080-Processor23] org.hibernate.jdbc.AbstractBatcher 31 Jul 2006 14:21:05,349 - closing statement
DEBUG: [http-8080-Processor23] org.hibernate.engine.StatefulPersistenceContext 31 Jul 2006 14:21:05,349 - initializing non-lazy collections
DEBUG: [http-8080-Processor23] org.hibernate.jdbc.JDBCContext 31 Jul 2006 14:21:05,349 - after autocommit
DEBUG: [http-8080-Processor23] org.hibernate.jdbc.ConnectionManager 31 Jul 2006 14:21:05,349 - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
DEBUG: [http-8080-Processor23] org.hibernate.impl.SessionImpl 31 Jul 2006 14:21:05,349 - after transaction completion
DEBUG: [http-8080-Processor23] org.springframework.orm.hibernate3.HibernateTemplate 31 Jul 2006 14:21:05,349 - Not closing pre-bound Hibernate Session after HibernateTemplate