Flyway vs Liquibase #Migration #Backwards-compatible
We were looking for a tool to help us integrating the migration scripts as part of our Deployment. At first sight both tools look very alike, are well integrated with Spring, have a fairly frequent development activity and short release cycles.
Liquibase puts a lot of emphasis on independence with the DB, allowing you to create the scripts on formats like JSON and YML, abstracting away from SQL, which it's also supported. Since we only work with one DB type across services we wouldn't take much advantage of this feature.
Flyway on the other hand has the advantage on being actively working on the integration with PostgreSQL 11, for it's upcoming version 6. Provides a more extensive set of properties that allow us to define what's allowed on what's not on each different environment.
Instead of looking for a tool that will allow us to rollback our DB changes automatically, we decided to implement backwards-compatible DB changes, for example adding a new column instead of renaming an existing one, postponing the deletion of the deprecated column until the release has been successfully installed.
Hibernate @mybatis, #ObjectRelationalMapperOrm
We needed a performant ORM that wouldn't add too much magic or complex intermediate layers.
Hibernate is a very mature tool, but it's gone too far in abstracting OOP from relational databases. It works nicely for simple CRUD operations and it's integration with Spring is fantastic. Its biggest downside, in our opinion, is when it comes to complex queries from several tables. For these cases it normally requires using HQL or other proprietary query building mechanisms.
MyBatis provides a very lightweight and mature ORM. We prefer it over Hibernate because:
It doesn't add an extra layer of complexity, you can either ask MyBatis Generator to generate the SQL queries for you, or write your own SQL
Writing SQL can be cumbersome, but with it you have great, standard mechanisms of optimization and can execute queries directly to a slave of your production DB to measure performance and improve it if needed.
Its integration with Spring is very straightforward nowadays. You can use annotation based DAOs and the mappers between fields and columns are automatic if you respect the naming conventions in both sides.
In general we feel that with MyBatis we can have a better development experience, easier to tune-up queries, zero boilerplate and a simplified integration test platform.