java.lang.NoSuchMethodError:org.hibernate.StatelessSession.createQuery(Ljava / lang / String;)Lorg / hibernate / Query

时间:2018-03-15 06:01:44

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

知道为什么我会收到此错误:

源码:

0 1
1 2
2 3
4 4
5 5
6 6
7 7
  

错误StackTrace: -

@Bean
    @StepScope
    public HibernateCursorItemReader<OrderDetail> reader(@Value("#{jobParameters['orderDate']}") final String orderDate) throws UnexpectedInputException, ParseException, Exception {
        LOGGER.info("START of reader() with args: ", orderDate);
        final Date beginDate = new Date();
        final Date endDate = new Date();
        final Map<String, Object> parameterValues = new HashMap<>();
        parameterValues.put("beginDate", beginDate);
        parameterValues.put("endDate", endDate);

        final HibernateCursorItemReader<OrderDetail> itemReader = new HibernateCursorItemReader<>();
        // TODO: explore if we can use HibernateQueryProvider -- itemReader.setQueryProvider(HibernateQueryProvider)
        itemReader.setQueryString("select dtl from OrderDetail dtl join OrderSummary sumy on dtl.summaryId = sumy.id where orderDate between :beginDate and :endDate order by id desc");
        itemReader.setParameterValues(parameterValues);

        itemReader.setSessionFactory(sessionFactory);
        itemReader.setUseStatelessSession(true);

        itemReader.afterPropertiesSet();

        LOGGER.info("END of reader()");

        return itemReader;
    }

0 个答案:

没有答案