DATACMNS-755 - Fixed QSort property translation for plain paths.
If standard Querydsl StringPaths are used without any reference to a query class tree, we previously dropped the first segment of the path expression. Moved to a completely different algorithm to determine the path by just using the Path's toString() representation and the root removed if necessary.
This commit is contained in:
@@ -31,6 +31,7 @@ import org.springframework.data.domain.Sort.Order;
|
||||
|
||||
import com.mysema.query.annotations.QueryInit;
|
||||
import com.mysema.query.types.OrderSpecifier;
|
||||
import com.mysema.query.types.path.StringPath;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link QSort}.
|
||||
@@ -202,6 +203,17 @@ public class QSortUnitTests {
|
||||
assertThat(sort, hasItems(new Order(Direction.ASC, "wrapperForUserWrapper.wrapper.user.firstname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-755
|
||||
*/
|
||||
@Test
|
||||
public void handlesPlainStringPathsCorrectly() {
|
||||
|
||||
QSort sort = new QSort(new OrderSpecifier<String>(com.mysema.query.types.Order.ASC, new StringPath("firstname")));
|
||||
|
||||
assertThat(sort, hasItems(new Order(Direction.ASC, "firstname")));
|
||||
}
|
||||
|
||||
@com.mysema.query.annotations.QueryEntity
|
||||
static class WrapperToWrapWrapperForUserWrapper {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user