Mapping JodaTime properties using JPA and custom UserTypes

JPA does not natively support mapping custom types to table columns. If you’re using Hibernate as your JPA provider then it does support custom UserTypes to provide mappings beyond the normal String to varchar, and other simple types.

For using the JodaTime’s DateTime, there’s a couple of options:

  • Joda Time Hibernate is a Hibernate contributed library (
  • UserType for Hibernate looks like it is an updated version of Joda Time Hibernate,   adds support for JSR310 (the new JDK Date implementation based on JodaTime), while also keeping backwards compatibility with Joda Time Hibernate

I tried UserType for Hibernate first, but got errors on a Roo generated @RooEntity:

private DateTime testDate;

I got this trying to persist:

java.lang.AbstractMethodError: org.jadira.usertype.dateandtime.joda.PersistentDateTime.nullSafeSet(Ljava/sql/PreparedStatement;Ljava/lang/Object;I)V
at org.hibernate.type.CustomType.nullSafeSet(

I’m not sure what this is about so switched the type to the Joda Time Hibernate library, and got it to work as expected straight away:

private DateTime testDate;

Apple sued over false advertising for Siri

About time. I’ve seen people trying to use Siri to get it to do things just like in the tv ads, and 9 times out of 10 it never works as you’d expect. Gives comic relief as everyone sniggers while said user is repeating themselves in a variety of different ways trying unsuccessfully to get it to work just like the ads and then giving up, yes, but working as in the tv ads? No. Far from it.

Android has always had support for voice actions, and while it’s more simple in that it uses simple recognized commands (‘navigate to [place name]’), and least it works the majority of the time.

Could Oracle end up losing money on their Java lawsuit against Google?

According to their original claims in 2010/2011, Oracle’s lawsuit against Google for Android violating Java related patents and copyright was worth somewhere between $1.6 billion and $6 billion in damages.

As the courts continued to throw out an increasing number of the claims, the estimated damages has come tumbling down. Right now, Oracle’s estimates are around $32 million. Google’s estimates are around $37 million.

At this rate, I wonder if it’s possible for Oracle to actually lose money on the case due to legal costs? $32 million is hardly big bucks for Google.

If Oracle had any sense, they should have licensed Android from Google as the replacement for Java ME, and not try to remove Android from the picture with legal action. Android is everything that Java ME should have been from the beginning but has always been so far from the mark.