Category Archives: Programming

Learning GO: Obtaining a unique sequence from #PostgresSQL with #golang

By | May 21, 2018

At some point I discovered GO trying to do very simple and fast code for specific tasks without having to load lots of libraries, deploy application servers or set up complicated frameworks. If you want to build fast very small native micro-services that can be deployed in a docker instance < 10MB Go is the… Read More »

Do not get stuck in #Java with Out of Memory threads.

By | February 28, 2018

In a JVM environment sometimes a thread can end up with an “OutOfMemoryError” exception. If this occurs we have a problem and most of the times this is so bad that we should no longer continue. The last thing you want in this case is to get stuck in a limbo state where your java… Read More »

Setup #Eclipse as #go IDE in Linux

By | August 28, 2017

I like Eclipse and I used it for many years on Linux for Java developement. I wanted to test how go(golang) works but I did not like all the suggested IDEs, you know the “cool” ones. I wanted to be able to use Eclipse. By default eclipse is not go oriented but with some small… Read More »

#Docker #Jboss dies with java.lang.OutOfMemoryError: Metaspace after several redeploys

By | May 26, 2017

There is an annoying issue with a Jboss EAP 7 Docker container I am using. After 3 deploys of my ear package I hit the “java.lang.OutOfMemoryError: Metaspace” issue. According to RedHat Solution 2038983 this is a known issue caused by: Root Cause The Metaspace is being exhausted. Either it is undersized, or there is a… Read More »

Debug tools for enterprise environments

By | February 8, 2017

There are various tools that I use to spot issues and investigate an enterprise environment. One of my favourite tools is IBM Performance Analysis Suite. Capabilities described by IBM: Import all kinds of performance data for analysis. Some examples: DB2 snapshot, Java verbose GC output, Java thread dumps. Import software/middle-ware configuration for compliance checking. Some… Read More »

Hibernate: Optimize updates with @DynamicUpdate

By | June 29, 2018

When using Hibernate as a layer between your Java code and the Database layer you release control on how the actual SQL query is generated. Hibernate will generate from the HSQL you write the “best” query. That “best” is in fact sometimes sub-optimal. A very important Hibernate 4 (make sure you have at least 4.2.5)… Read More »

JavaEE: Caching costly data across a transaction with TransactionSynchronizationRegistry

By | February 8, 2017

Everybody knows that a database query is extremely costly in enterprise application and usually has the biggest impact in process time of a transaction. There are plenty of best practice rules a developer has to follow: 1. Retrieve as much data as possible in a single query, avoid to make a data retrieve from the… Read More »

Hibernate: Avoiding a “fake” exception: javax.persistence.TransactionRequiredException: Executing an update/delete query

By | October 21, 2017

I encountered some weird issue caused by the way Hibernate works. The exception messages returned by Hibernate are confusing as they are just a side-effect of the real issue. The code in question was something like that: In a manager bean we have the following: @Stateless(name = “ObjectManagerBean”, mappedName = “ObjectManagerBean/remote”) public class ObjectManagerBean …… Read More »

Java EE: Make an @Entity “empty” using a @Transient proxy

By | February 8, 2017

In some cases while optimizing code to minimize the database footprint of a Java EE application we get to the point of trying to get rid of duplicate data. In a lot of cases several steps of the processing flow tend to store partially processed data or states of data and in a lot of… Read More »

DB2: SQL Error: -803, SQLState: 23505, Unique Constraint Violation

By | December 8, 2019

Yet another thread of DB2 errors from an EJB application that connects to a DB2 instance. The reported thread of errors: [7/13/16 12:46:38:670 IST] 00000098 SqlExceptionH Z org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions [jcc][t4][102][10040][4.19.26] Batch failure. The batch was submitted, but at least one exception occurred on an individual member of the batch. Use getNextException() to retrieve the exceptions… Read More »