Till now, I have used liquibase with spring and standard changelog file. Now I want to integrate it to hibernate so when I do any change to entity, it should change tables and update changelog table.
I read many examples, and tutorials and can't get it work.
I use datasource, entityManagerFactory(denepds-on="liquibase") all work fine. But when I add liquibase bean it doesn't change database from entity. And "no table with name" exception is thrown.
How to configure Liquibase with liquibase-hibernate4 and spring?
my liquibase bean:
<bean id="liquibase" class="liquibase.integration.spring.SpringLiquibase">
<property name="dataSource" ref="myJdbcDataSource" />
<property name="beanName" value="entityManagerFactory" />
<property name="changeLog" value="classpath:databaseChangeLog.sql" />
</bean>
I just added beanName prop as entityManagerFactory from: https://github.com/liquibase/liquibase-hibernate/wiki, http://www.liquibase.org/documentation/spring.html. And did what I can understand from this posts.
In this posts, it mentioned that we should use one of three variants
hibernate:spring:com/example/spring.xml?bean=sessionFactory
hibernate:spring:com.example?dialect=org.hibernate.dialect.MySQL5Dialect
hibernate:spring:com.example.employee,com.example.auction?dialect=org.hibernate.dialect.MySQL5Dialect
But I don't know how to use it with liquibase bean when we using spring