Tag: Hibernate

6 March

Like I posted here we are currently busy replacing the Postgres database with an Oracle database. One issue we encountered was the use of boolean fields in the Postgres database, because there is no such type in the Oracle database. So we chose to create a Varchar2(1) field that contains a ‘t’ or ‘f’, being ‘true’ or ‘false’.
Continue reading…


10 December

Do you recognize this: Although you are using a tool to develop your applications for some time, you are suddenly surprised by a certain error message you haven’t seen before? And you didn’t do anything different compared to the last time you used it.
Well, my experience is that in 100 times out of a 100, you did do something different. My last time in this situation was when I wanted to use a Java 1.5 enum type as a field in my EJB3 entity bean. I had done this before and at first sight everything looked well. Here was what I did:
Continue reading…


25 April

To store information in our PostgreSQL database we use Spring and Hibernate as I mentioned earlier in my posts. Some of our tables in the database also have GIS information with them. That’s why we are also using PostGIS extension on our database. This GIS information (Geometry) is also reflected in the Hibernate objects we use to persist our data.
We have experienced that this Geometry data can be invalid, in which case the database (JDBC) is throwing an UncategorizedSQLException. This is the case, for example, when a Polygon has a different start and ending point.
In our application we have two kinds of exceptions: the CustomException (thrown and handled by ourselves) and all other exceptions not handled by us. With this distinction between the exceptions I can decide what to do when an exception occurs, for example, when storing data in the database: is it our CustomException, then it is most probably a problem with this instance and I will move to process the next instance. If there is thrown another Exception, then there is something seriously wrong and I will stop the processing.
Continue reading…


6 March

When you are working with Hibernate there is a big chance you have (or will) run into the lazy loading exception: org.hibernate.LazyInitializationException: failed to lazily initialize a collection – no session or session was closed. Well, last week it was my turn. Luckiliy there are lots and lots of articles and blogs about it on the net so in a short time you will have enough information about it to fill at least a day or two by reading them.
Continue reading…