Tag: Joda-Time
-
Spring MVC: Handling Joda Data Types as JSON
PROBLEM Let’s assume we have the following bean that contains Joda’s LocalDate and LocalDateTime objects:- This simple Spring MVC rest controller creates this bean and returns the JSON data back to the client:- By default, the generated JSON looks like this:- How do we nicely format these values and still retain the correct data types… Read More…
-
Jadira Usertype: Under JDK 6 it may not be possible to handle DST transitions correctly
PROBLEM When saving a Hibernate entity that contains Joda Time object, Jadira UserType throws the following warning:- This warning occurs when using this version:- SOLUTION Upgrade Jadira Usertype to the latest version, and the problem goes away:- Read More…
-
Hibernate + Joda Time: Auto Registering Type
OVERVIEW Jadira Usertype is required when using Joda Time with Hibernate 4. The Joda Time objects are annotated accordingly in the Hibernate entity, and they looks something like this:- PROBLEM This solution works, but it is rather tedious because I can never remember the actual @Type to write, thus I always end up copying and… Read More…
-
Hibernate: Migrating from XML-Based Configuration to Annotation-Based Configuration
Overview At some point of time, as your project scope grows, the Hibernate mapping XML files are going to get to a point where it becomes very difficult to maintain. This is where the annotation-based configuration comes in. It took me a few years to convince myself that annotation-based configuration is the way to go.… Read More…