tags:

views:

296

answers:

3

I'm looking for a way to persist an entity which contains a field of a user type. In this particular example I would like to persist the ts field as number of milliseconds.

import org.joda.time.DateTime;

@Entity
public class Foo {

  @Id
  private Long id;

  private DateTime ts;
}
A: 

Since it's not a JPA defined supported type you rely on implementation specifics. DataNucleus has a plugin for JodaTime that would allow your desired persistence.

DataNucleus
+2  A: 

JPA does not have the ability to register custom property types, you'll have to use provider specific stuff:

Pascal Thivent
A: 

JPA2 doesn't supports User Defined Types?

I'am trying to persist a LocalDateTime from JodaTime without using Hibernate Specific Annotations. Any hints?

Thanks you in advance. Mauro Ciancio

Mauro Ciancio