mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#526 - findPagedList with @EmbeddedId broken - automatically adds orderby t0.null
This commit is contained in:
@@ -2316,7 +2316,7 @@ public class BeanDescriptor<T> implements MetaBeanInfo, SpiBeanType<T> {
|
||||
*/
|
||||
public void appendOrderById(SpiQuery<T> query) {
|
||||
|
||||
if (idProperty != null) {
|
||||
if (idProperty != null && !idProperty.isEmbedded()) {
|
||||
OrderBy<T> orderBy = query.getOrderBy();
|
||||
if (orderBy == null || orderBy.isEmpty()) {
|
||||
query.order().asc(idProperty.getName());
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.avaje.tests.compositekeys;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.avaje.ebean.PagedList;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -51,6 +52,8 @@ public class TestCKeyLazyLoad extends BaseTestCase {
|
||||
|
||||
Ebean.save(p2);
|
||||
|
||||
exerciseMaxRowsQuery_with_embeddedId();
|
||||
|
||||
CKeyParentId searchId = new CKeyParentId(1, "one");
|
||||
|
||||
CKeyParent found = Ebean.find(CKeyParent.class).where().idEq(searchId).findUnique();
|
||||
@@ -79,4 +82,15 @@ public class TestCKeyLazyLoad extends BaseTestCase {
|
||||
Assert.assertTrue(idInTestList.size() == 2);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Exercise paging/maxRows type query with EmbeddedId.
|
||||
*/
|
||||
private void exerciseMaxRowsQuery_with_embeddedId() {
|
||||
|
||||
PagedList<CKeyParent> siteUserPage = Ebean.find(CKeyParent.class).where()
|
||||
.orderBy("name asc")
|
||||
.findPagedList(0, 10);
|
||||
siteUserPage.getList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user