我尝试过以下方法
liquibase:generateChangeLog- 它从我的数据库生成更改日志。我需要change-log从我的JPA entities.
liquibase:diff- 它生成我的数据库和实体之间差异的更改日志JPA。我不能说我的数据库总是空的,我想生成可以应用于新数据库的创建脚本。
如何仅Liquibase根据我的实体生成脚本JPA?
注意:我可以提供有关我的数据库的详细信息,例如网址、驱动程序等
我正在运行jacoco插件来生成html,xml并jacoco.exec报告以测量我的testNg测试所测试的代码的覆盖范围.
我在本地和以及Jenkins我的所有单元测试结果中成功生成了这些报告,Sonar并且它向我展示了覆盖范围.
我jacoco.exec的模块和依赖模块的覆盖率都有.我已经验证了这个eclemma plugin用于eclipse.
我没有在Sonar的依赖模块中获得覆盖结果.任何一个我做错了.
我的插件就是这样的
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我的目标是 jacoco:report-aggregate
我正在spring以validate模式启动容器
autoddl =验证
我收到这样的验证异常
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-
validation: wrong column type encountered in column [amount] in table [Balance];
found [numeric (Types#NUMERIC)], but expecting [int8 (Types#BIGINT)]
Run Code Online (Sandbox Code Playgroud)
我的DDL脚本是这样的
CREATE TABLE Balance(stratr VARCHAR(25), histFromDate TIMESTAMP WITHOUT TIME
ZONE,amount numeric(11, 0))
Run Code Online (Sandbox Code Playgroud)
我在JPA实体中的属性是这样的
@Column(name="amount", precision=11, scale=0) //have specified precision and scale
private Long amount ;
Run Code Online (Sandbox Code Playgroud)
在这里我使用了import javax.persistence.Column。既然我已经注释的准确精度和规模,不应该用这些信息冬眠验证,我已经通过了列注释提供?我可能错过了什么?
我无法执行以下操作
@Column(
columnDefinition = "NUMERIC(11,0)"
)
private Long amount;
Run Code Online (Sandbox Code Playgroud)
因为我不知道这个JPA实体的数据存储。
我也尝试通过以下属性生成脚本
<prop key="javax.persistence.schema-generation.scripts.action">drop-and-create</prop>
<prop key="javax.persistence.schema-generation.scripts.create-target">./l/create.sql</prop>
<prop key="javax.persistence.schema-generation.scripts.drop-target">./l/drop.sql</prop>
Run Code Online (Sandbox Code Playgroud)
这也生成as int8和not numeric(11,0) …
我正在尝试changeLog从diff数据库和持久性实体之间的 s 生成。
我正在使用 liquibase hibernate 插件
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.4.1</version>
<configuration>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
</configuration>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate4</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.1.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.7.3.RELEASE</version>
</dependency>
</dependencies>
</plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)
我的liquibase.properties情况是这样的
changeLogFile=classpath:liquibase-changeLog.xml
url=jdbc:postgres://localhost:5432/oauth_reddit
username=tutorialuser
password=tutorialmy5ql
driver=org.postgresql.Driver
referenceUrl=com.sample.App
?dialect=org.hibernate.dialect.PostgreSQLDialect
diffChangeLogFile=src/main/resources/liquibase-diff-changeLog.xml
Run Code Online (Sandbox Code Playgroud)
执行时mvn liquibase:diff,我收到以下错误
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.4.1:diff (default-cli) on project prototype-liquibase-migration: Error setting up or running Liquibase: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified …Run Code Online (Sandbox Code Playgroud) 我试图将 java 类型映射到 SQL 类型,我遇到了这样的场景。
如果我详细说明,我auto-ddl在启动 spring 容器时使用api 将脚本应用于我的数据库。现在,我想生成使用脚本liquibase通过生成db-changelog的POSTGRE服务器。
Postgres 服务器中的 numeric(9,0) 和 INT 是否相同?请对此有所了解。
每种类型可以存储多少字节的数据?
我试图将 java 类型映射到 SQL 类型,我遇到了这样的场景。
如果我详细说明,我auto-ddl在启动spring容器时使用api 将脚本应用于我的数据库。现在,我想生成使用脚本liquibase通过生成db-changelog的POSTGRE服务器。
是numeric(19,0)与BIGINT在Postgres的服务器一样吗?请对此有所了解。
hibernate ×2
java ×2
liquibase ×2
postgresql ×2
spring-boot ×2
eclemma ×1
jenkins ×1
jpa ×1
sonarqube ×1
spring ×1