hmmm... it still doesn't work. i changed it to
Expression.like("name", "%" + name + "%")).uniqueResult();
and it still shows the same error. there isnt any sql generated shown when i turn on the "hibernate.show_sql". however if it runs fine, the sql is
Hibernate: select this_.id as id0_0_, this_.name as name0_0_ from XXX this_ where this_.name like ?
btw, "hihi." with the period is a valid entry in the db which i wish to query...
the following is the debug log from log4j
00:39:46,265 INFO Environment:509 - Hibernate 3.2.2 00:39:46,265 INFO Environment:542 - hibernate.properties not found 00:39:46,265 INFO Environment:676 - Bytecode provider name : cglib 00:39:46,265 INFO Environment:593 - using JDK 1.4 java.sql.Timestamp handling 00:39:46,328 INFO Configuration:1426 - configuring from resource: /hibernate.cfg.xml 00:39:46,328 INFO Configuration:1403 - Configuration resource: /hibernate.cfg.xml
// mapping class removed
00:39:46,984 INFO Configuration:1541 - Configured SessionFactory: SessionFactory
// mapping collection removed
00:39:47,031 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!) 00:39:47,031 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 10 00:39:47,031 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
// mysql connection properties removed
00:39:47,453 INFO SettingsFactory:89 - RDBMS: MySQL, version: 5.0.37-community-nt 00:39:47,453 INFO SettingsFactory:90 - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.0.5 ( $Date: 2007-03-01 00:01:06 +0100 (Thu, 01 Mar 2007) $, $Revision: 6329 $ ) 00:39:47,468 INFO Dialect:152 - Using dialect: org.hibernate.dialect.MySQLDialect 00:39:47,468 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions) 00:39:47,468 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 00:39:47,468 INFO SettingsFactory:143 - Automatic flush during beforeCompletion(): disabled 00:39:47,468 INFO SettingsFactory:147 - Automatic session close at end of transaction: disabled 00:39:47,468 INFO SettingsFactory:154 - JDBC batch size: 15 00:39:47,468 INFO SettingsFactory:157 - JDBC batch updates for versioned data: disabled 00:39:47,468 INFO SettingsFactory:162 - Scrollable result sets: enabled 00:39:47,484 INFO SettingsFactory:170 - JDBC3 getGeneratedKeys(): enabled 00:39:47,484 INFO SettingsFactory:178 - Connection release mode: auto 00:39:47,484 INFO SettingsFactory:202 - Maximum outer join fetch depth: 2 00:39:47,484 INFO SettingsFactory:205 - Default batch fetch size: 1 00:39:47,484 INFO SettingsFactory:209 - Generate SQL with comments: disabled 00:39:47,484 INFO SettingsFactory:213 - Order SQL updates by primary key: disabled 00:39:47,484 INFO SettingsFactory:382 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 00:39:47,484 INFO ASTQueryTranslatorFactory:24 - Using ASTQueryTranslatorFactory 00:39:47,484 INFO SettingsFactory:221 - Query language substitutions: {} 00:39:47,484 INFO SettingsFactory:226 - JPA-QL strict compliance: disabled 00:39:47,484 INFO SettingsFactory:231 - Second-level cache: enabled 00:39:47,484 INFO SettingsFactory:235 - Query cache: disabled 00:39:47,484 INFO SettingsFactory:369 - Cache provider: org.hibernate.cache.NoCacheProvider 00:39:47,484 INFO SettingsFactory:250 - Optimize cache for minimal puts: disabled 00:39:47,484 INFO SettingsFactory:259 - Structured second-level cache entries: disabled 00:39:47,484 INFO SettingsFactory:279 - Echoing all SQL to stdout 00:39:47,484 INFO SettingsFactory:286 - Statistics: disabled 00:39:47,484 INFO SettingsFactory:290 - Deleted entity synthetic identifier rollback: disabled 00:39:47,484 INFO SettingsFactory:305 - Default entity-mode: pojo 00:39:47,500 INFO SettingsFactory:309 - Named query checking : enabled 00:39:47,515 INFO SessionFactoryImpl:161 - building session factory 00:39:47,906 INFO SessionFactoryObjectFactory:86 - Factory name: SessionFactory 00:39:47,906 INFO NamingHelper:26 - JNDI InitialContext properties:{} 00:39:47,906 WARN SessionFactoryObjectFactory:98 - Could not bind factory to JNDI javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(Unknown Source) at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source) at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source) at javax.naming.InitialContext.getNameParser(Unknown Source) at org.hibernate.util.NamingHelper.bind(NamingHelper.java:52) at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:90) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:306) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
00:39:47,953 ERROR XXXHome:40 - findByName failed java.lang.ArrayIndexOutOfBoundsException: 0 at org.hibernate.util.StringHelper.cleanAlias(StringHelper.java:356) at org.hibernate.util.StringHelper.generateAliasRoot(StringHelper.java:337) at org.hibernate.util.StringHelper.generateAlias(StringHelper.java:319) at org.hibernate.loader.criteria.CriteriaQueryTranslator.createCriteriaSQLAliasMap(CriteriaQueryTranslator.java:236) at org.hibernate.loader.criteria.CriteriaQueryTranslator.<init>(CriteriaQueryTranslator.java:82) at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:58) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1550) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305)
|