I want to try out Joda Time with Play Framework 2.0. So I have this class called Release:
@Entity
public class CommunicationLog extends Model {
private static final long serialVersionUID = 7846963755390952329L;
@Id
public int pk;
public Task taskRef;
public String comment;
@Type(type = "org.joda.time.contrib.hibernate.PersistentDateTime")
public DateTime createdDate;
public Person personRef;
}
In this post ( Persist Joda-time's DateTime via Hibernate ), I have read to use joda-time-hibernate. So I add this to my dependencies with SBT and it downloads the jar file and adds it to my classpath:
"joda-time" % "joda-time-hibernate" % "1.3"
But the problem remains that the @Type cannot be resolved. I need to add also org.hibernate.annotations and hibernate core to my classpath? Why is this not part of JPA 2.0? Or do I miss something else in my project?
EDIT 2012-05-07 : SOLVED WITH
It works when I add the following dependencies:
"org.hibernate" % "hibernate-core" % "3.5.6-Final",
"org.hibernate" % "hibernate-annotations" % "3.5.6-Final",
"joda-time" % "joda-time-hibernate" % "1.3"
Yes, you must add org.hibernate.annotations to your classpath.
@Typeis part of Hibernate logic (Custom UserType), it’s not a logic of JPA.So you must mix JPA annotations with Hibernate annotations