[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4586?page=c...
]
Steve Ebersole commented on HHH-4586:
-------------------------------------
@Emmanuel, did you push a snapshot build? If not I do not think those are up to date with
this fix.
The plan is to have hudon push the nightly snapshot builds to the snapshot repo. I have
discussed this with Juca but I do not believe that is in place as of yet.
@zhouyanming, your best bet is to checkout trunk and build yourself
Parameterized functions built throught CriteriaBuilder missing
parameters when rendered
---------------------------------------------------------------------------------------
Key: HHH-4586
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4586
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager, query-criteria
Affects Versions: 3.5.0-Beta-2
Reporter: zhouyanming
Assignee: Steve Ebersole
Priority: Blocker
Fix For: 3.5
Time Spent: 3 hours, 17 minutes
Remaining Estimate: 0 minutes
CriteriaBuilder cb = ...
CriteriaQuery<User> cq = ...
Metamodel metamodel = ...
Root<User> root = cq.from(User.class);
EntityType<User> entityType = metamodel.entity(User.class);
Expression expression = root.get(entityType.getSingularAttribute("username"));
Predicate condition = cb.equal(cb.lower(expression), "test");
cq.where(condition);
Hibernate: select user0_.id as id0_, user0_.username as username0_ from users user0_
where lower()=? limit ?
09/11/18 15:09:59 WARN util.JDBCExceptionReporter: SQL Error: 1582, SQLState: 42000
09/11/18 15:09:59 ERROR util.JDBCExceptionReporter: Incorrect parameter count in the call
to native function 'lower'
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2235)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
at org.hibernate.loader.Loader.list(Loader.java:2124)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:411)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1084)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:238)
at
org.hibernate.ejb.criteria.CriteriaQueryCompiler$2.getSingleResult(CriteriaQueryCompiler.java:125)
at org.ironrhino.core.service.BaseManagerImpl$3.doInJpa(BaseManagerImpl.java:156)
at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:184)
... 39 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Incorrect parameter
count in the call to native function 'lower'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2228)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1810)
at org.hibernate.loader.Loader.doQuery(Loader.java:695)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:257)
at org.hibernate.loader.Loader.doList(Loader.java:2232)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira