Memory leaks from CDI

The usual way of dependency injection with CDI using @Inject offers an extremely efficient mechanism to supply an object with its dependencies. However, there are scenarios where a dynamic version of dependency injection is required. For those cases, CDI offers javax.enterprise.inject.Instance, an interface that allows for the dynamic injection of new instances at runtime on […]
Fabian König
comment icon 0 19.06.2020

Continuous database integration with Liquibase

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.
Oliver Pitzschel
comment icon 0 12.04.2017

Generate database schema DDL script with JPA or Hibernate

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.
Andreas Günzel
comment icon 14.10.2016

Mocking framework comparison: Mockito

Unit testing is essential to produce good software. As a unit test is intended to cover only a very small piece of code we need to mock out other components. This post provides an introduction into the widely used mocking framework Mockito.
Andreas Günzel
comment icon 0 10.08.2016

Basics of continuous database integration with liquibase

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.
Steffen Mall
comment icon 1 07.06.2016

Fighting the Transaction Reaper

Long running transactions might be killed by the App Server's Transaction Reaper. I have implemented a litte helper to programmatic handle such kinds of exceptions.
Andreas Günzel
comment icon 0 31.05.2016

Intermediate commit within transaction

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.
Andreas Günzel
comment icon 0 19.05.2016

How to start a new transaction inside a single EJB

When invoking a method of an EJB we get features like transactions, security or monitoring for free. However, this only works when the method call is intercepted by the container. So, method calls within the same bean do not enjoy this benefits. There is a nice hack to solve this problem.
Paulin Nguimdoh
comment icon 3 05.04.2016

Dynamically resolve Hibernate database dialect

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.
Andreas Günzel
comment icon 2 23.03.2016