Hibernate using JPA (annotated Entities) and liquibase

Yes, Liquibase uses hibernate’s metadata classes, which are the same whether you use xml mappings or annotations. You do need a hibernate config file to point liquibase to, but your mappings can be xml or jpa annotations. More information can be found at https://github.com/liquibase/liquibase-hibernate/wiki but you can use “database urls” such as hibernate:classic:com/example/hibernate.cfg.xml if you … Read more

Liquibase lock – reasons?

Sometimes if the update application is abruptly stopped, then the lock remains stuck. Then running UPDATE DATABASECHANGELOGLOCK SET LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1; against the database helps. You may also need to replace LOCKED=0 with LOCKED=FALSE. Or you can simply drop the DATABASECHANGELOGLOCK table, it will be recreated.

comparing databases and generating sql script using liquibase

Obtaining the SQL statements, representing the diff between two databases, is a two step operation: Generate the XML “diff” changelog Generate SQL statements Example This example requires a liquibase.properties file (simplifies the command-line parameters): classpath=/path/to/jdbc/jdbc.jar driver=org.Driver url=jdbc:db_url1 username=user1 password=pass1 referenceUrl=jdbc:db_url2 referenceUsername=user2 referencePassword=pass2 changeLogFile=diff.xml Now run the following commands to create the SQL statements: liquibase diffChangeLog … Read more