Isolated unit testing of Java EE and Spring components

When developing modern Spring or Jakarta EE based applications and micro services there is a need for fine-granular component testing. I.e. you do not want to test your code in a full-blown environment only, because such tests will be slow.

Instead, you might want to write tests at the component level using a mixture of mocked dependencies and real assets like the (in-memory) database.

needle4k is a Kotlin-based relaunch and upgrade of the well-known needle4j framework. It may be used with any JVM-based language and allows to develop modular tests with minimal effort.

Continue reading

Enhancing Hibernate’s metadata model

Hibernate internally uses an abstract metadata model to validate the data model defined by the declared entities. The framework also offers entry points to enhance this metadata model with custom code.

In this article we show how to extend the generated metadata model using annotations. Our example is to implement a convenient way to define common table prefixes for subclasses of a “@MappedSuperclass” entity.

Continue reading

Creating “inherited” indexes with JPA/Hibernate

For optimal performance developers often define database indexes in the JPA data model classes. While this is relatively easy at entity class level, it becomes quite cumbersome if you your model consists of a deeply nested inheritance hierarchy using “mapped” super classes. I.e., there is no direct way that indexes defined for super classes will be added to entities automatically. Instead you have to repeat them every time.

In this article we show how to to circumvent this problem using Hibernate’s MetadataBuilderImplementor SPI.

Continue reading

Creating coherent Networks for docker development

Docker is a great tool for developing micro services that may be composed together in order to form a larger application. However, Docker containers run in a network apart from the host machine. That makes it sometimes cumbersome and complicated to use common host names within the Docker network and the host network. In this article we’ll show a simple knack that may be applied in order to use identical host names in both networks.

Continue reading

GuttenBase database migration framework 2.0.0 released

We’re glad to announce the new release of the GuttenBase database migration framework. The main but not only goal of this framework is to support database migrations between different (heterogenous) RDBMS, such as DB2, MySQL or Oracle. During the copying process you may apply various transformations such as data mapping, columns alteration, renaming tables, …

The 2.0 release features among various API enhancements and speed improvements: Java 8 support, a new tool to copy schemas between different databases, more supported database types, mapping of proprietary database column types, new documentation, …

Continue reading

JBoss EAP/WildFly configuration project

When developing applications using the JBoss EAP/WildFly application server there is a repetitive task that has been solved differently over and over again: The configuration of the application server, i.e. installing JDBC drivers, startup scripts, data sources, JMS destinations, logging categories, etc.
Within our company there are several projects addressing this problem. In this post we’d like to propose a project to combine all those different requirements and experiences into a single build system.

Continue reading