Category Archives: Programming

Hibernate: Optimize updates with @DynamicUpdate

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 »


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

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 »

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

Yet another thread of DB2 errors from an EJB application that connects to a DB2 instance. The reported thread of errors:

We get several DB2 error codes there that may make it more clear. Let me take you through them : 1. SQL Error: -4229, SQLState: null Translated: “Batch failure. The batch was submitted,… Read More »

DB2: SQL Error: -803, SQLState: 23505 due to NON-UTF8 character in parameter

Sometimes Java and databases do not use the same standards to represent data. This can lead to strange exceptions for which sometimes can be hard to pin point the cause. We have the following Exception reported in the enterprise application log. Let’s analyse the errors.

STEP 1 SQL Error: -302, SQLState: 22001 The value… Read More »

CVS: Add a missing tag by date for a CVS project release

Sometimes you discover that you forgot to tag on CVS a test release that made it on the production system. The issue starts when you discovered that in the mean time you or someone else already added new functionality on the development branch. In the following I will create a tag only based on the… Read More »

DB2 + Websphere : Feature is not implemented: PreparedStatement.setBinaryStream

From a very strange reason after updating the hibernate4 from version 4.1.4 to 4.2.5 there was suddenly a weird behaviour of the EJB3.1 enterprise application I am working on. A piece of code that commits to the database an object (ProcessingStatus) containing a BLOB was throwing the following: [1/31/16 23:37:15:922 EET] 000000eb AbstractBatch Z org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl… Read More »