org.hibernate.exception.SQLGrammarException: 无法在不同的 weblogic 服务器上执行语句

org.hibernate.exception.SQLGrammarException: could not execute statement on different weblogic server

我的应用程序中有一个简单的创建查询。(Spring 5.2.10 + Hibernate 5.4.3.1 + Weblogic 12c)

它在我的本地 weblogic 服务器上运行良好,但在刷新时在另一个 weblogic 服务器上出错。他们使用相同的数据源。

org.hibernate.exception.SQLGrammarException: could not execute statementjavax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute statement
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
    at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1366)
    at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1349)
    at com.thy.dao.impl.BaseDAOImpl.create(BaseDAOImpl.java:46)

我尝试配置 weblogic.xml 更喜欢下面的应用程序包,但还是不行。

<wls:prefer-application-packages>
            <wls:package-name>javax.persistence.*</wls:package-name>
            <wls:package-name>org.hibernate.*</wls:package-name>
        </wls:prefer-application-packages>
</wls:container-descriptor>

我找到了解决办法,sql语法没有错误。问题与数据库端存储的 procedure/function 相关,它通过新插入触发。堆栈跟踪不包含此异常,我在 weblogic 日志中找到它。