Java, Web and Mobile

Blog

JSON-B is coming

|
Java EE

Java EE7 introduced JSON-P, which is supposed to standardize processing and parsing of JSON. This year, EE8 now brings ‘Java API for JSON Binding’ (JSON-B). Time for a closer look.

Generate database schema DDL script with JPA or Hibernate

|
Java|Java EE

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.

Intermediate commit within transaction

|
Java|Java EE

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.

JAX 2016: Tuesday Close-up

|
Java

Last year’s JAX was clearly stamped by the buzzword Microservice. For me, the term microservice was even more present today. Okay, Tuesday was marked as “MICROSERVICES DAY”. However, no attendee could by-pass this topic (not even in talks about JavaScript or upcoming Java 9 release).

How to unit test hazelcast

|
Java|Testing

Recently I used hazelcast in several projects. Especially in an Application Server environment using the hazelcast JCA connector it is pretty easy to use hazelcast with only a few lines of code. Unfortunately, Hazelcast.getAllHazelcastInstances() returns an empty set in unit tests. So, what we need to do is to mock our HazelcastFactory somehow.

Dynamically resolve Hibernate database dialect

|
Java|Java EE

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.