Thanks to this thread, I was able to register and use a custom Converter
for org.joda.time.DateTime
using JPA EclipseLink. Here is a sample use (only the relevant parts):
@Converter(name = "jodaTimeConverter", converterClass = JodaDateTimeConverter.class)
public class MyEntity{
@Column(name = "creationdate")
@Temporal(TemporalType.TIMESTAMP)
@Convert("jodaTimeConverter")
private DateTime creationdate;
}
I have many entity classes an most of them have a DateTime
field. My question is thus: is it possible to register the converter once somewhere, so that all DateTime
fields are automatically converted ?
I could obviously copy-paste the annotations everywhere, but a more DRY method would be appreciated.