我正在尝试用liquibase配置简单的maven项目。我在liquibase maven插件和liquibase hibernate4的版本上遇到了很多问题,这些版本不会产生大的堆栈跟踪,但最终我几乎让它工作了。但当我执行mvn liquibase:diff时,它以消息<code>liquibase:未发现任何更改,无需执行</code>结束。
这是我的诗:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.mlewando.ff</groupId>
<artifactId>liquibase_test</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.7.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.14.8</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<changeLogFile>src/main/resources/db/db.changelog.xml</changeLogFile>
<diffChangeLogFile>src/main/resources/db/generated-db.changelog.xml</diffChangeLogFile>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/liquibase_test?characterEncoding=utf8</url>
<username>root</username>
<password>root</password>
<referenceUrl>hibernate:spring:pl.mlewando.ff.model?dialect=org.hibernate.dialect.MySQL5InnoDBDialect</referenceUrl>
<verbose>true</verbose>
<logging>debug</logging>
</configuration>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate4</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.7.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.6.Final</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
并从 mvn liquibase:diff
记录:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building liquibase_test_backend 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- liquibase-maven-plugin:3.2.1:diff (default-cli) @ liquibase_test_backend ---
[INFO] ------------------------------------------------------------------------
[INFO] Loading artfacts into URLClassLoader
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/data/spring-data-jpa/1.7.0.RELEASE/spring-data-jpa-1.7.0.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/data/spring-data-commons/1.9.0.RELEASE/spring-data-commons-1.9.0.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-orm/4.0.7.RELEASE/spring-orm-4.0.7.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-jdbc/4.0.7.RELEASE/spring-jdbc-4.0.7.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-context/4.1.1.RELEASE/spring-context-4.1.1.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-expression/4.1.1.RELEASE/spring-expression-4.1.1.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-aop/4.0.7.RELEASE/spring-aop-4.0.7.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-tx/4.0.7.RELEASE/spring-tx-4.0.7.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-beans/4.0.7.RELEASE/spring-beans-4.0.7.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-core/4.0.7.RELEASE/spring-core-4.0.7.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/aspectj/aspectjrt/1.8.2/aspectjrt-1.8.2.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.7/jcl-over-slf4j-1.7.7.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/hibernate/hibernate-entitymanager/4.3.6.Final/hibernate-entitymanager-4.3.6.Final.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/jboss/logging/jboss-logging/3.1.3.GA/jboss-logging-3.1.3.GA.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/jboss/logging/jboss-logging-annotations/1.2.0.Beta1/jboss-logging-annotations-1.2.0.Beta1.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/hibernate/hibernate-core/4.3.6.Final/hibernate-core-4.3.6.Final.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/jboss/jandex/1.1.0.Final/jandex-1.1.0.Final.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.5.Final/hibernate-commons-annotations-4.0.5.Final.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.0.Final/jboss-transaction-api_1.2_spec-1.0.0.Final.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/projectlombok/lombok/1.14.8/lombok-1.14.8.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/mysql/mysql-connector-java/5.1.32/mysql-connector-java-5.1.32.jar
[INFO] artifact: file:/C:/Users/mlewandowski/IdeaProjects/forfun/liquibase_test/backend/target/classes/
[INFO] artifact: file:/C:/Users/mlewandowski/IdeaProjects/forfun/liquibase_test/backend/target/test-classes
[INFO] ------------------------------------------------------------------------
[INFO] Settings
----------------------------
[INFO] driver: com.mysql.jdbc.Driver
[INFO] url: jdbc:mysql://localhost:3306/liquibase_test?characterEncoding=utf8
[INFO] username: root
[INFO] password: *****
[INFO] use empty password: false
[INFO] properties file: null
[INFO] properties file will override? false
[INFO] prompt on non-local database? true
[INFO] clear checksums? false
[INFO] changeLogFile: src/main/resources/db/db.changelog.xml
[INFO] context(s): null
[INFO] referenceDriver: null
[INFO] referenceUrl: hibernate:spring:pl.mlewando.ff.model?dialect=org.hibernate.dialect.MySQL5InnoDBDialect
[INFO] referenceUsername: null
[INFO] referencePassword: null
[INFO] referenceDefaultSchema: null
[INFO] diffChangeLogFile: src/main/resources/db/generated-db.changelog.xml
[INFO] ------------------------------------------------------------------------
DEBUG 25.11.14 12:07: liquibase: Connected to root@localhost@jdbc:mysql://localhost:3306/liquibase_test?characterEncoding=utf8
DEBUG 25.11.14 12:07: liquibase: Setting auto commit to false from true
[INFO] Executing on Database: jdbc:mysql://localhost:3306/liquibase_test?characterEncoding=utf8
[INFO] Loading artfacts into URLClassLoader
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/data/spring-data-jpa/1.7.0.RELEASE/spring-data-jpa-1.7.0.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/data/spring-data-commons/1.9.0.RELEASE/spring-data-commons-1.9.0.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-orm/4.0.7.RELEASE/spring-orm-4.0.7.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-jdbc/4.0.7.RELEASE/spring-jdbc-4.0.7.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-context/4.1.1.RELEASE/spring-context-4.1.1.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-expression/4.1.1.RELEASE/spring-expression-4.1.1.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-aop/4.0.7.RELEASE/spring-aop-4.0.7.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-tx/4.0.7.RELEASE/spring-tx-4.0.7.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-beans/4.0.7.RELEASE/spring-beans-4.0.7.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/springframework/spring-core/4.0.7.RELEASE/spring-core-4.0.7.RELEASE.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/aspectj/aspectjrt/1.8.2/aspectjrt-1.8.2.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.7/jcl-over-slf4j-1.7.7.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/hibernate/hibernate-entitymanager/4.3.6.Final/hibernate-entitymanager-4.3.6.Final.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/jboss/logging/jboss-logging/3.1.3.GA/jboss-logging-3.1.3.GA.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/jboss/logging/jboss-logging-annotations/1.2.0.Beta1/jboss-logging-annotations-1.2.0.Beta1.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/hibernate/hibernate-core/4.3.6.Final/hibernate-core-4.3.6.Final.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/jboss/jandex/1.1.0.Final/jandex-1.1.0.Final.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.5.Final/hibernate-commons-annotations-4.0.5.Final.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.0.Final/jboss-transaction-api_1.2_spec-1.0.0.Final.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/org/projectlombok/lombok/1.14.8/lombok-1.14.8.jar
[INFO] artifact: file:/C:/Users/mlewandowski/.m2/repository/mysql/mysql-connector-java/5.1.32/mysql-connector-java-5.1.32.jar
[INFO] artifact: file:/C:/Users/mlewandowski/IdeaProjects/forfun/liquibase_test/backend/target/classes/
[INFO] artifact: file:/C:/Users/mlewandowski/IdeaProjects/forfun/liquibase_test/backend/target/test-classes
[INFO] ------------------------------------------------------------------------
DEBUG 25.11.14 12:07: liquibase: Connected to null@hibernate:spring:pl.mlewando.ff.model?dialect=org.hibernate.dialect.MySQL5InnoDBDialect
DEBUG 25.11.14 12:07: liquibase: Not adjusting the auto commit mode; it is already false
INFO 25.11.14 12:07: liquibase-hibernate: Reading hibernate configuration hibernate:spring:pl.mlewando.ff.model?dialect=org.hibernate.dialect.MySQL5InnoDBDialect
INFO 25.11.14 12:07: liquibase-hibernate: Found package pl.mlewando.ff.model
INFO 25.11.14 12:07: liquibase-hibernate: Found dialect org.hibernate.dialect.MySQL5InnoDBDialect
INFO 25.11.14 12:07: liquibase-hibernate: Found hibernate.enhanced_idfalse
lis 25, 2014 12:07:37 PM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
name: default
...]
lis 25, 2014 12:07:37 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.3.1.Final}
lis 25, 2014 12:07:37 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
lis 25, 2014 12:07:37 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
lis 25, 2014 12:07:37 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
lis 25, 2014 12:07:37 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
INFO 25.11.14 12:07: liquibase-hibernate: Using dialect org.hibernate.dialect.MySQL5InnoDBDialect
[INFO] Performing Diff on database root@localhost @ jdbc:mysql://localhost:3306/liquibase_test?characterEncoding=utf8 (Default Schema: liquibase_test)
DEBUG 25.11.14 12:07: liquibase: Computed checksum for 1416913657501 as 5fde170700e5d1ee87d42598486086ef
INFO 25.11.14 12:07: liquibase-hibernate: Found table User
INFO 25.11.14 12:07: liquibase-hibernate: Found table User
INFO 25.11.14 12:07: liquibase-hibernate: Found column id bigint
INFO 25.11.14 12:07: liquibase-hibernate: Found column name varchar(255)
INFO 25.11.14 12:07: liquibase-hibernate: Found primary key UserPK
INFO 25.11.14 12:07: liquibase: src\main\resources\db\generated-db.changelog.xml exists, appending
DEBUG 25.11.14 12:07: liquibase: MissingObjectChangeGenerator type order: liquibase.structure.core.Catalog liquibase.structure.core.Schema liquibase.structure.core.Sequence liquibase.structure.core.StoredProcedure liquibase.structure.core.Table liquibase.structure.core.Column liquibase.structure.core.PrimaryKey liquibase.structure.core.UniqueConstraint liquibase.structure.core.ForeignKey liquibase.structure.core.Index liquibase.structure.core.View
DEBUG 25.11.14 12:07: liquibase: UnexpectedObjectChangeGenerator type order: liquibase.structure.core.Catalog liquibase.structure.core.ForeignKey liquibase.structure.core.Schema liquibase.structure.core.StoredProcedure liquibase.structure.core.UniqueConstraint liquibase.structure.core.View liquibase.structure.core.Table liquibase.structure.core.PrimaryKey liquibase.structure.core.Column liquibase.structure.core.Index liquibase.structure.core.Sequence
DEBUG 25.11.14 12:07: liquibase: ChangedObjectChangeGenerator type order: liquibase.structure.core.Catalog liquibase.structure.core.ForeignKey liquibase.structure.core.Schema liquibase.structure.core.Sequence liquibase.structure.core.StoredProcedure liquibase.structure.core.Table liquibase.structure.core.Column liquibase.structure.core.PrimaryKey liquibase.structure.core.Index liquibase.structure.core.UniqueConstraint liquibase.structure.core.View
INFO 25.11.14 12:07: liquibase: No changes found, nothing to do
[INFO] Differences written to Change Log File, src/main/resources/db/generated-db.changelog.xml
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.129 s
[INFO] Finished at: 2014-11-25T12:07:37+01:00
[INFO] Final Memory: 20M/308M
[INFO] ------------------------------------------------------------------------
在< code > src/main/Java/pl/mlewando/ff/model 中,我有一个简单的类:
package pl.mlewando.ff.model;
import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
@Data
class User {
@Id
private long id;
private String name;
}
和persistence.xml
中的src/main/资源/META-INF/
:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
</properties>
</persistence-unit>
</persistence>
数据库liquibase_test
是空的,当我执行mvn liquibase:更新
与空的db.changelog.xml
它创建表数据库记录
和数据库记录
,但在那之后,当我运行mvn liquibase: diff
它仍然看不到用户表。
我做错了什么?谢谢!
编辑:
当我尝试使用此命令从命令行差异时:
liquibase
--driver=com.mysql.jdbc.Driver
--url=jdbc:mysql://localhost:3306/liquibase_test_ref
--username=root
--password=root
diffChangeLog
--referenceUrl="hibernate:spring:pl.mlewando.ff.model?dialect=org.hibernate.dialect.MySQL5InnoDBDialect"
一切正常,我最终得到这个更新日志:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.2.xsd http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet author="mlewandowski (generated)" id="1416923630350-1">
<createTable tableName="User">
<column name="id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="name" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="mlewandowski (generated)" id="1416923630350-2">
<addPrimaryKey columnNames="id" constraintName="UserPK" tableName="User"/>
</changeSet>
</databaseChangeLog>
我有3.2.1版本的liquibase(与pom.xml中的相同),这些jar位于classpath中:
antlr-2.7.7.jar
aopalliance-1.0.jar
aspectjrt-1.8.2.jar
dom4j-1.6.1.jar
hibernate-commons-annotations-4.0.5.Final.jar
hibernate-core-4.3.1.Final.jar
hibernate-entitymanager-4.3.6.Final.jar
hibernate-envers-4.3.1.Final.jar
hibernate-jpa-2.1-api-1.0.0.Final.jar
jandex-1.1.0.Final.jar
javassist-3.18.1-GA.jar
jboss-logging-3.1.3.GA.jar
jboss-logging-annotations-1.2.0.Beta1.jar
jboss-transaction-api_1.2_spec-1.0.0.Final.jar
jcl-over-slf4j-1.7.7.jar
liquibase_test_backend-1.0.jar
liquibase-hibernate4-3.4.jar
mysql-connector-java-5.1.33.jar
slf4j-api-1.7.7.jar
snakeyaml-1.13.jar
spring-aop-4.0.7.RELEASE.jar
spring-beans-4.0.7.RELEASE.jar
spring-context-4.1.1.RELEASE.jar
spring-core-4.0.7.RELEASE.jar
spring-data-commons-1.9.0.RELEASE.jar
spring-data-jpa-1.7.0.RELEASE.jar
spring-expression-4.1.1.RELEASE.jar
spring-jdbc-4.0.7.RELEASE.jar
spring-orm-4.0.7.RELEASE.jar
spring-tx-4.0.7.RELEASE.jar
xml-apis-1.0.b2.jar
但是我真的想通过maven来做。所以,再一次:我做错了什么?
我不确定这是否相关,但前段时间我在liquibase-hibernte-plugin
上发现了类似的错误。我正在使用带有hiberante 4的Spring本地会话工厂,它也没有发现更改。
调试后,我发现liquibase hibernate插件
使用了导入org.springframework.orm.hibernate3.LocalSessionFactoryBean
转换为HibernateSpringDatabase。java
,因此它无法读取我的配置。
我更改了它并生成了一个拉请求,现在它对我来说工作正常。
如果你想尝试一下,你可以使用我修改过的liquibase-hibernate-plugin,使用下面的maven依赖项:
<dependency>
<groupId>com.github.malaguna</groupId>
<artifactId>liquibase-hibernate</artifactId>
<version>liquibase-hibernate4-3.6.1</version>
</dependency>
但是首先,您必须将JitPack repo添加到maven pom.xml:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
希望有帮助!
问题内容: 我有一个具有以下结构的数据库: 当我尝试创建EntityProperty类时 我得到以下异常: 我知道JPA实体必须具有主键,但是由于无法控制的原因,我无法更改数据库架构。是否可以创建将与这样的数据库模式一起工作的JPA(hibernate)实体? 问题答案: 我猜您有一个组合键,其中的外键是。如果是这样,则可以按如下所示进行映射:
也许,我搜索了所有的互联网,但我一定错过了什么。 我根据文档配置Log4j2和Commons日志。我添加了,但其配置对应用程序输出没有影响。我看Log4j没有读这个文件。这是我的配置: pom.xml \src\main\资源\log4j2.xml 在任何类中-例如A类 应用程序具有函数,因此可以由IDE或mvn exec:java运行。 问题: 日志记录正在工作-但使用默认方式。 正如您在文件中
当我使用Git Bash(在Windows上)时,我不能在不指定其完整路径的情况下运行任何可执行文件,尽管它位于我的PATH变量中的文件夹中。看来巴什不认识它。为什么啊?我能修好它吗?
问题内容: 我想创建一个类,该类可以映射到使用JPA本机查询从数据库中提取的结果。有没有办法将没有基础表的实体映射到结果?我提到这个链接,使得它的hibernate。可以使用JPA代替吗? 这是我要为其映射结果的班级。 问题答案: JPA 2.1规范定义了将结果从本机查询返回到非实体类的方法 您应该检出标题 3.10.16.2返回非托管实例, 尤其是 3.10.16.2.2构造函数结果 使用 Sq
我想创建一个可以映射到使用JPA原生查询从数据库提取的结果的类。有没有办法将没有基础表的实体映射到结果?我提到了这个允许它Hibernate的链接。这可以用JPA来代替吗? 这是我想要映射结果的类。
问题内容: 我使用jQuery通过json请求从数据库检索内容。然后,它将HTML中的通配符(如%title%)替换为实际内容。这很好用,这样我就可以在数据库中维护多语言文本,但是Googlebot只看到通配符,而不是实际内容。我知道Googlebot可以看到没有javascript的页面,但是有没有办法解决这个问题?谢谢! 问题答案: 您应该在Google上仔细阅读本文档。 它讨论了如何使Goo