I have a JPA entity
called customer and goes like this
@Entity
public class Customer {
private int custNo;
private String custName;
private
I used the liquibase-hibernate plugin
for this!. It is capable of generating the changeset
for a JPA entity even if its corresponding table is not there in the db.
The plugin
org.liquibase
liquibase-maven-plugin
3.4.1
src/main/resources/liquibase.properties
org.liquibase.ext
liquibase-hibernate4
3.5
org.springframework
spring-beans
4.1.7.RELEASE
org.springframework.data
spring-data-jpa
1.7.3.RELEASE
and the liquibase.properties
changeLogFile=classpath:liquibase-changeLog.xml
url=jdbc:mysql://localhost:3306/oauth_reddit
username=tutorialuser
password=tutorialmy5ql
driver=com.mysql.jdbc.Driver
referenceUrl=hibernate:spring:org.baeldung.persistence.model
?dialect=org.hibernate.dialect.MySQLDialect
diffChangeLogFile=src/main/resources/liquibase-diff-changeLog.xml
The referenceUrl
is using package scan, so the dialect parameter is required. changeLogFile
is the location of changeset for which the db is in sync. diffChangeLogFile
is the location where the difference changelog has to be flushed.