spring data - ElasticSearch and SpringData: FindAll and OrderBy -
i need documents, ordered fied (parent in case).
in itemrepository added following signature:
public list<item> findallorderbyparent(); but invoking it, a
org.springframework.web.util.nestedservletexception: request processing failed; nested exception org.springframework.data.repository.query.parameteroutofboundsexception: invalid parameter index! seem have declare little query method parameters! the same postponing asc or desc method name.
somewhere read correct syntax should following (note by after findall):
public list<item> findallbyorderbyparent(); here a
nullpointerexception caused by: java.lang.nullpointerexception @ org.springframework.data.elasticsearch.core.elasticsearchtemplate.count(elasticsearchtemplate.java:333) @ org.springframework.data.elasticsearch.repository.query.elasticsearchpartquery.execute(elasticsearchpartquery.java:54) ... i'm excluding other issues because declaring method public list<item> findbynameorderbyparent(); everithing works fine.
do have idea proceed?
thank you
this might bit late since problem still there, around used findall method using sort object param:
list<item> findall(sort sort); and call it:
list<item> items = this.itemrepository.findall(new sort(new sort.order(sort.direction.desc, "name"))); the "name" property can extract in constant or make service's listitems method support dynamic sort , send sort field parameter.
you can have @ article: http://maciejwalkowiak.pl/blog/2012/05/09/sorting-spring-data-mongodb-collections-using-orderby/
Comments
Post a Comment