Hibernate postgresql/hsqldb TEXT column incompatibility problem

前端 未结 6 1734
醉酒成梦
醉酒成梦 2021-01-02 00:26

I have a problem using Hibernate and PostgreSQL for production and HSQLDB for testing.
I am using top-down approach letting Hibernate create database schema.
I a

6条回答
  •  温柔的废话
    2021-01-02 00:54

    To get H2 to work in compatability mode with PostgreSQL (useful for junit testing).

    # JDBC Driver
    jdbc.driverClassName=org.h2.Driver
    jdbc.url=jdbc:h2:mem:play;MODE=PostgreSQL;TRACE_LEVEL_SYSTEM_OUT=2;DB_CLOSE_DELAY=-1;IGNORECASE=TRUE;INIT=CREATE TABLE IF NOT EXISTS PG_CLASS (RELNAME text, RELKIND text);
    jdbc.username=sa
    jdbc.password=
    
    # general hibernate options
    hibernate.database=h2
    hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
    

    The create table PG_CLASS is required to allow Hibernate/JPA to correctly function. But other than that - pretty seamless.

提交回复
热议问题