我试图使用liquibase-hibernate5(Spring-5.0.4.RELEASE,Hibernate-5.2.15)通过liquibase-maven-plugin在Hibernate实体(来自单个基本包)和干净数据库(Oracle 11gR2 XE)之间生成差异.最后,JPA-2.1.1应用程序通过servlet 3.1与所有(完整)程序配置).我使用JSON作为更改日志格式,liquibase-hibernate5(v3.6)使用liquibase-maven-plugin(v3.5.5).配置中使用的JPA规范版本是2.1.1.来自POM的片段:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.mvn.plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>${liquibase.version}</version>
</dependency>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate5</artifactId>
<version>${liquibase.hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>${jpa.version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${validation.api.version}</version>
</dependency>
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>${jdbc.driver.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml.version}</version>
</dependency>
</dependencies>
<configuration>
<propertyFile>src/main/resources/jdbc/schema/liquibase.properties</propertyFile>
<propertyFileWillOverride>true</propertyFileWillOverride>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration>
<executions>
<execution>
<goals>
<goal>diff</goal>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
这是我目前的liquibase.properties:
url: jdbc:oracle:thin:@localhost:1521/xe
username: db_user
password: password
driver: oracle.jdbc.OracleDriver
referenceUrl: hibernate:spring:org.example.something.entities?dialect=org.hibernate.dialect.Oracle10gDialect …Run Code Online (Sandbox Code Playgroud)