#970 - FOR UPDATE queries are not honored when beans are already cached

This commit is contained in:
Rob Bygrave
2017-02-21 22:53:14 +13:00
parent 3d8db775f7
commit 8bb884374b
2 changed files with 11 additions and 0 deletions
@@ -2,6 +2,7 @@ package io.ebeaninternal.server.querydefn;
import io.ebean.Ebean;
import org.tests.model.basic.Customer;
import org.tests.model.basic.Order;
import org.junit.Test;
@@ -9,6 +10,15 @@ import static org.assertj.core.api.Assertions.assertThat;
public class DefaultOrmQueryTest {
@Test
public void when_forUpdate_then_excludeFromBeanCache() {
DefaultOrmQuery<Customer> q1 = (DefaultOrmQuery<Customer>) Ebean.find(Customer.class)
.setForUpdate(true).where().eq("id", 42).query();
assertThat(q1.isExcludeBeanCache()).isTrue();
}
@Test
public void checkForId_when_eqId_then_translatedTo_setId() {