Predicate throws IllegalArgumentException
See original GitHub issuespringboot version: 1.5.9 querydsl version: 4.1.4
service query code:
public List<Timeline> searchAllByUserId(long userId, int pageIndex, int pageSize) {
QTimeline qTimeline = QTimeline.timeline;
Predicate predicate = qTimeline.userId.longValue().eq(userId);
PageRequest page = new PageRequest(pageIndex, pageSize, new Sort(Sort.Direction.DESC, "createAt"));
return timelineRepository.findAllByUserId(predicate, page);
}
exception:
org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [timeline.userId = 2] did not match expected type [java.lang.Long (n/a)]; nested exception is java.lang.IllegalArgumentException: Parameter value [timeline.userId = 2] did not match expected type [java.lang.Long (n/a)]
Caused by: java.lang.IllegalArgumentException: Parameter value [timeline.userId = 2] did not match expected type [java.lang.Long (n/a)]
at org.hibernate.jpa.spi.BaseQueryImpl.validateBinding(BaseQueryImpl.java:897)
at org.hibernate.jpa.internal.QueryImpl.access$000(QueryImpl.java:61)
at org.hibernate.jpa.internal.QueryImpl$ParameterRegistrationImpl.bindValue(QueryImpl.java:235)
at org.hibernate.jpa.spi.BaseQueryImpl.setParameter(BaseQueryImpl.java:638)
anyone could give me some tips ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Java Predicates In clause: illegal argument exception?
What is the issue? private Long getResultsCount(Predicate predicate) throws ATSException { CriteriaBuilder countBuilder = entityManager ...
Read more >Predicate Illegal Argument Exception - Google Groups
Hi,. I am using SQLPredicate in my application. My keys are strings and values are VersionedPortable Objects. int mdns_hazelcast_map_init ...
Read more >janusgraph-users@lists.lfaidata.foundation | Connective predicate ...
Connective predicate with id throws an IllegalArgumentException (Invalid condition) ... predicate with string ids, it fails with an IllegalArgumentException:.
Read more >Predicate (Java Platform SE 8 ) - Oracle Help Center
Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another. When evaluating the composed predicate, if this ...
Read more >Source code - Apache Commons - The Apache Software Foundation!
Predicate; 031import org.apache.commons.collections4.bag. ... if collection or predicate is null 100 * @throws IllegalArgumentException if the collection ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
findAllByUserId
Spring data will generate a
select ... where user.id = ?
query. So you just pass in the id, not a predicate.so disappointed no one give a damn to new issue… @meatballhat @rocketraman @johnktims @ponzao @msiedlarek