Quantcast
Viewing all articles
Browse latest Browse all 128

Orderby Clause with Nested Inner Object Properties is not working

I am using latest version of spring mongodb framework.

I have two Objects

Class Object1 {
private long uid;
private Object2 obj2;
}

class Object2 {
private long userPercentage;
}

How can i write a repository query to get the List of all Objects order by the obje2.userPercentage value

I have wrote the query like this.



public interface Object1Repository extends NoSqlRepository<Object1, String> {

public List<Object1> findByUidOrderByObj2UsedPercentage(long uid);
}

The above repository query was working in the earlier version of the spring mongodb. where as in the recent release order is not working.

Am i doing the right way or am i missing any thing or this orderby approach for the nested objects is wrong.


Can some one please tell me what i am doing wrong here or what is the best way to get the list of object using the above orderby clause.

Viewing all articles
Browse latest Browse all 128

Trending Articles