org.hibernate.exception.DataException:ORA-01843:不是有效月份

时间:2016-07-20 14:36:05

标签: java hibernate

    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy");
criteria.addOrder(OrderBySqlFormula
                                 .sqlFormula("CASE WHEN to_char(to_date('"
                                              + sdf.format(new Date())
                                              + "'), '') between START_DATE and END_DATE THEN '1' else to_char(END_DATE) END DESC"));

这是条件子句适用于Windows环境但在我们部署生产时出现以下错误,生产环境是linux,国家也与本地环境不同:  org.hibernate.exception.DataException:ORA-01843:不是有效月份

    at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:72)
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
    at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129)
    at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
    at com.sun.proxy.$Proxy6277.executeQuery(Unknown Source)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:1962)
    at org.hibernate.loader.Loader.scroll(Loader.java:2519)
    at org.hibernate.loader.criteria.CriteriaLoader.scroll(CriteriaLoader.java:117)
    at org.hibernate.internal.SessionImpl.scroll(SessionImpl.java:1493)
    at org.hibernate.internal.CriteriaImpl.scroll(CriteriaImpl.java:388)

0 个答案:

没有答案