我尝试在spring persistence config中将liquibase设置为javabean,设置hibernate.hbm2ddl.auto=validate,但最终还是失败了
org.springframework.beans.factory.beancreationexception:创建ru.rambler.alexeimohov.spring.persistenceconfig中定义的名为“entitymanagerfactory”的bean时出错:调用init方法失败;嵌套异常为javax.persistence.persistenceexception:[persistenceunit:default]无法构建hibernate sessionfactory;嵌套异常为org.hibernate.tool.schema.spi.schemamanagementexception:架构验证:缺少表[地址]
如果我设置hbm2ddl.auto=update,hibernate构建所有表,liquibase构建databasechangelog和databasechangeloglock。我尝试在liquibase bean上使用@order(ordered.highest\u priority),但没有成功。
在db.init\u 1.0.xml中只有一个表用于测试:
<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-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<changeSet author="author" id="1">
<createTable tableName="address"
schemaName="first">
<column name="id" type="bigint">
</column>
</createTable>
</changeSet>
</databaseChangeLog>
1条答案
按热度按时间i2byvkas1#
@dependson解决了我的问题。