Software developer constantly need to implement and deploy a new version of an application. In issue 5-2017 of German Java magazine, our colleague Steffen Mall argues that simple and fast refactoring of a database model is one of the most important things in order to implement flexible business requirements.
Using an object-relational mapping framework like Hibernate disburdens developers from creating complex DDL scripts to setup an application’s database schema. However, in real life such scripts are still needed – at least for the DBA who forbids applications to alter database objects. This post shows how to easily generate the database schema DDL script without typing an SQL commands.
In addition to my first liquibase post I give you some best practice in order to integrate liquibase in JUnit using hibernate JPA to ensure same datamodel during unit test and other stages. Use the power of mockito to setup your JUnit test class and inject your entity manager.
Simple and fast refactoring of your database model is one of the most important things in order to implement flexible business requirements. Learn the basics of continuous database integration with liquibase. Liquibase supports tracking, managing and applying database schema changes. Feel the power and simplicity of liquibase.
For long running transactions sometimes we wish to commit a kind of intermediate result to the database. This sounds pretty simple – however, if we do not want to commit the current transaction, you may run into deadlock situations. In my current project I implemented a nice solution using JPA and EJB.
When using Hibernate as JPA provider you need to tell the application which database vendor you are using. The classic approach is to set the property "hibernate.dialect". This works in most cases. However, I often have to cope with different database vendors serving the same datasource - depending on the current environment. A solution to this problem is to use a DialectResolver that dynamically detects the needed Hibernate dialect to talk to the database.