首页 > 解决方案 > Hibernate/Postgres revınfo 不存在

问题描述

我们正在使用 Hibernate Envers 进行审计。一切都在我们的本地机器上运行。但是当我们在 CentOS 7 上将 Spring Boot 应用程序部署到 Tomcat 9 时,envers 无法审计数据。Postgres 版本:13

例外;

    Caused by: org.postgresql.util.PSQLException: ERROR: relation "revınfo" does not                                                                                                                                                              exist
  Position: 13
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryEx                                                                                                                                                             ecutorImpl.java:2553)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutor                                                                                                                                                             Impl.java:2285)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.ja                                                                                                                                                             va:323)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:473)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:393)
        at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedSt                                                                                                                                                             atement.java:164)
        at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedState                                                                                                                                                             ment.java:130)
        at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPrep                                                                                                                                                             aredStatement.java:61)
        at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(Hik                                                                                                                                                             ariProxyPreparedStatement.java)
        at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(                                                                                                                                                             ResultSetReturnImpl.java:197)
        ... 149 more

它说 revıinfo 不存在,但实际上确实存在。Revinfo 表名:“revinfo” 可能存在编码问题。这里是我们对 jpa 的设置;

                put("hibernate.physical_naming_strategy", "foo.app.util.db.HibernatePhysicalNamingStrategy");
                put("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
                put("hibernate.current_session_context_class", "thread");
                put("hibernate.session_factory.interceptor", persistenceInterceptor);
                // envers
                put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
                put("org.hibernate.envers.audit_table_suffix", "_hist");
                put("hibernate.characterEncoding", "UTF-8");
                put("hibernate.CharSet", "UTF-8");
                put("hibernate.useUnicode", "true");
                put("hibernate.connection.CharSet", "UTF-8");
                put("hibernate.connection.characterEncoding", "UTF-8");
                put("hibernate.connection.useUnicode", "true");

我们在桌子上使用蛇盒。你有什么主意吗?

标签: postgresqlhibernateencodingtomcat9hibernate-envers

解决方案


推荐阅读