2016-12-26 48 views
0

将1.3.5版本的弹簧引导版本升级到1.4.2后,似乎是DB2ZOS方言在Spring JPA早期的分页查询中不起作用。 我使用Spring JPA和DB2,当我使用分页存储库和查询第二页时,它抛出错误。这是生成的查询。将Spring引导版本从1.3.5升级到1.4.2后,DB2ZOS方言不起作用

select 
     * 
    from 
     (select 
      inner2_.*, 
      rownumber() over(
     order by 

     order of inner2_) as rownumber_ from 
      (select 
       componentd0_.comp_data_field_st_msg_id as comp_dat1_0_, 
       componentd0_.comp_data_file_id as comp_dat5_0_, 
       componentd0_.comp_data_file_field_id as comp_dat6_0_, 
       componentd0_.component_serial_no as componen2_0_, 
       componentd0_.controller_short_name as controll3_0_, 
       componentd0_.message as message4_0_ 
      from 
       cs_comp_data_field_st_msg componentd0_ 
      left outer join 
       cs_comp_data_file componentd1_ 
        on componentd0_.comp_data_file_id=componentd1_.comp_data_file_id 
      where 
       componentd1_.comp_data_file_id=? 
      order by 
       componentd0_.comp_data_field_st_msg_id asc fetch first 50 rows only) as inner2_) as inner1_ 
     where 
      rownumber_ > 25 
     order by 
      rownumber_ 
o.h.engine.jdbc.spi.SqlExceptionHelper : DB2 SQL Error: SQLCODE=-199, SQLSTATE=42601, SQLERRMC=OF;??([ DESC ASC NULLS RANGE CONCAT ||/MICROSECONDS MICROSECOND, DRIVER=3.69.24 
2016-12-26 13:41:42.886 ERROR [componentdatafiles,c50b4d59a68eb961,c50b4d59a68eb961,false] AK51602  20296 --- [io-8081-exec-75] o.h.engine.jdbc.spi.SqlExceptionHelper : DB2 SQL Error: SQLCODE=-516, SQLSTATE=26501, SQLERRMC=null, DRIVER=3.69.24 
2016-12-26 13:41:42.887 ERROR [componentdatafiles,c50b4d59a68eb961,c50b4d59a68eb961,false] AK51602  20296 --- [io-8081-exec-75] o.h.engine.jdbc.spi.SqlExceptionHelper : DB2 SQL Error: SQLCODE=-514, SQLSTATE=26501, SQLERRMC=SQL_CURLH200C1, DRIVER=3.69.24 
2016-12-26 13:41:42.918 DEBUG [componentdatafiles,c50b4d59a68eb961,c50b4d59a68eb961,false] AK51602  20296 --- [io-8081-exec-75] c.d.c.n.service.NonDeereXmlServiceImpl : Critical system error 

org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet 
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:261) 
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:244) 
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:491) 
    at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59) 
    at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213) 
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) 
    at org.springframework.data.jpa.repository.support.CrudMethodMeta 

回答

0

org.hibernate.dialect.DB2Dialect类生成无效的查询,之所以其failing.I具有覆盖getLimit功能在我的方言,它的解决。

+0

所以它不是春天,但休眠....方言是从休眠类。 –

+0

是的,你的org.hibernate.dialect.DB2Dialect类是正确的。我编辑了答案。 –

+0

你不是简单地使用了错误的方言吗?对于Z/OS,您必须使用'DB2400Dialect'或'DB2390Dialect'而不是默认的'DBD2Dialect'。 –

相关问题