I have this Data Model
public class CustomerModel{
@Column
@Type(type=\"org.joda.time.contrib.hibernate.PersistentDateTime\")
private DateTime members
Unfortunately with JodaTime the only way around this is using the Between keyword and use two DateTime instances making up the day.
interface CustomerRepo extends Repository{
List findByMemberShipDateBetween(DateTime start, DateTime end);
}
If your domain model used Java Dates internally you could've used this style:
interface CustomerRepo extends Repository{
List findByMemberShipDate(@Temporal(TemporalType.DATE) Date date);
}
Not the @Temporal annotation is a custom Spring Data JPA one as the plain JPA one is currently not allowed on parameters. The reason that this only works with Java Dates unfortunately is a limitation of the current JPAPIs. The setParameter(…) method on Query only takes a TemporalType for parameters of type Date. We could try converting the JodaTime objects on parameter binding but I guess the persistence providers will reject that due to the type mismatch then (Date VS. DateTime).