Problem with Specification query on App Engine/Datanucleus
I'm encountering a problem using Spring Data JPA 1.2.0 in combination with Datanucleus 3.1.3 on App Engine.
Code:
public interface CustomerRepository extends JpaRepository<Club, Long>, JpaSpecificationExecutor<Club> {
List<Customer> findByLastImportDateGreaterThan(Date lastImportDate, Pageable pageable);
}
This works perfectly and the query being executed is:
"SELECT FROM com.mycomp.domain.Customer DN_THIS WHERE (DN_THIS.lastImportDate > :DN_PARAM_0)"
Now when I try to the same using a Specification like:
Code:
public static Specification<Customer> eligibleForImport(Date date) {
return new Specification<Customer>() {
@Override
public Predicate toPredicate(Root<Customer> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
return cb.greaterThan(root.<Date> get("lastImportDate"), date);
}
};
}
The compiled query looks like:
"SELECT FROM com.mycomp.domain.Customer DN_THIS WHERE (DN_THIS.lastImportDate > Sat Aug 04 06:04:38 CEST 2012)"
>> Note the actual date being printed..
And this gives a exception like:
[INFO] org.springframework.orm.jpa.JpaSystemException: expected ')' at character 31 in "(DN_THIS.lastImportDate > Sat Aug 04 06:04:38 CEST 2012)"
I wonder if this is a problem on Datanucleus/App Engine side or not.
I've enabled debug logging for Spring Data but don't see anything being logged btw.
log4j.category.org.springframework.data.jpa = DEBUG
Any suggestions?