mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-22 15:10:02 +00:00
#2626 - For readOnly disableLazyLoad using Collections.EMPTY_LIST etc for reference collections
This commit is contained in:
1 parent
a70461d779
commit
84042397b6
8 files changed
+58
-8
No files matched your search
@@ -1,5 +1,8 @@
|
||||
package org.tests.query;
|
||||
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.EntityBeanIntercept;
|
||||
import io.ebean.bean.InterceptReadOnly;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Query;
|
||||
@@ -7,8 +10,11 @@ import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestQueryOrderById extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
@@ -28,6 +34,13 @@ public class TestQueryOrderById extends BaseTestCase {
|
||||
} else if (!isOracle()) {
|
||||
assertSql(query).isEqualTo("select t0.id, t0.name from o_customer t0 order by t0.id limit 5 offset 1");
|
||||
}
|
||||
|
||||
assertThat(list).isNotEmpty();
|
||||
Customer customer = list.get(0);
|
||||
EntityBeanIntercept intercept = ((EntityBean) customer)._ebean_getIntercept();
|
||||
assertThat(intercept).isInstanceOf(InterceptReadOnly.class);
|
||||
assertThat(customer.getOrders()).isSameAs(Collections.EMPTY_LIST);
|
||||
assertThat(customer.getContacts()).isSameAs(Collections.EMPTY_LIST);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user