JPA 2.0 and @Type annotation in Play Framework

I want to try Joda Time with Play Framework 2.0. So I have this class named 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 ( DateTime Persist Joda-timeTime via Hibernate ), I read to use joda-time-hibernate . So I add this to my dependencies with SBT and download the jar file and add it to my classpath:

"joda-time" % "joda-time-hibernate" % "1.3"

      

But the problem remains that @Type cannot be resolved. Do I need to add also org.hibernate.annotations and hibernate core to my classpath? Why isn't this part of JPA 2.0? Or am I missing 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"

      

+3


source to share


1 answer


Yes, you have to add org.hibernate.annotations to your classpath.
@Type

is part of Hibernate logic (Custom UserType), it is not JPA logic.
Therefore you have to combine JPA annotations with Hibernate annotations



+4


source







All Articles