在EntityManager中创建查询时发生异常

时间:2017-10-09 19:42:50

标签: java spring hibernate spring-mvc spring-boot

我决定在我的应用程序中为EclipseLink交换Hibernate提供程序。 SpringData生成的每个命令都是错误的。例如Spring Security loadUserByUsername ()生成的命令(这是https://github.com/JonkiPro/REST-Web-Services/blob/master/web/src/main/java/com/web/web/security/service/impl/UserDetailsServiceImpl.java的实现)方法是错误的

    [EL Fine]: sql: 2017-10-09 21:26:34.622--ServerSession(292310859)--Connection(87448307)--SELECT ID AS a1 FROM users WHERE (UPPER(USERNAME) = UPPER(?)) LIMIT ?, ?
    bind => [3 parameters bound]
[EL Fine]: sql: 2017-10-09 21:26:34.745--ServerSession(292310859)--SELECT 1
[EL Warning]: 2017-10-09 21:26:34.799--UnitOfWork(1238172133)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.0.v20170811-d680af5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: LIMIT syntax #, # is not supported
  Note: Use separate LIMIT and OFFSET clauses.
  Item: 64
Error Code: 0
Call: SELECT ID AS a1 FROM users WHERE (UPPER(USERNAME) = UPPER(?)) LIMIT ?, ?
    bind => [3 parameters bound]
Query: TupleQuery(referenceClass=UserEntity sql="SELECT ID AS a1 FROM users WHERE (UPPER(USERNAME) = UPPER(?)) LIMIT ?, ?")
2017-10-09 21:26:34.823 DEBUG 4536 --- [nio-8443-exec-8] .m.m.a.ExceptionHandlerExceptionResolver : Resolving exception from handler [public boolean com.web.web.controller.CheckUserDataRestController.checkUsername(java.lang.String,boolean)]: org.springframework.orm.jpa.JpaSystemException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.0.v20170811-d680af5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: LIMIT syntax #, # is not supported
  Note: Use separate LIMIT and OFFSET clauses.
  Item: 64

Query: TupleQuery(referenceClass=UserEntity sql="SELECT ID AS a1 FROM users WHERE (UPPER(EMAIL) = UPPER(?)) LIMIT ?, ?")

此命令自动生成。我不能在这里改变任何东西,但它显示了一个错误。 EclipseLink在读取Hibernate理解的查询时遇到问题。

0 个答案:

没有答案