Reputation: 265
I am having problems using spring jpa using a Distinct. My goal it's to return the whole object, instead just the field that pass to "Distinct".
And I want to Distinct the "Test_ID" where FLOW_ID = 345 So I am doing this:
Page findTestIdDistinctByFlowId(Pageable pageable, String FlowID);
Instead of this (my goal):
Any advice? Another option?
Upvotes: 0
Views: 154
Reputation: 81988
Distinct doesn't apply on a column or select expression it operates on a row in SQL or an entity in JPA.
Since the returned IDs differ the rows are not distinct and get all returned.
I suspect you could achieve what you want with an explicitly written SQL or JPQL statement. But I'm not at all clear what the actual criteria is that you want to use.
Upvotes: 1