#1849 - JoinColumn not found when using @Encrypted(dbEncryption = true) and findCount

This commit is contained in:
rob bygrave
2019-11-06 20:33:56 +13:00
parent d2c88bf7c6
commit 1a8a43603e
3 changed files with 69 additions and 1 deletions
@@ -10,6 +10,7 @@ import io.ebeaninternal.api.SpiEbeanServer;
import org.ebeantest.LoggedSqlCollector;
import org.junit.Test;
import org.tests.model.basic.EBasicEncrypt;
import org.tests.model.basic.EBasicEncryptRelate;
import java.sql.Date;
import java.util.List;
@@ -34,6 +35,26 @@ public class TestEncrypt extends BaseTestCase {
assertThat(loggedSql.get(0)).contains("; --bind(****,Rob%)");
}
@Test
@ForPlatform(Platform.H2) // only run this on H2 - PGCrypto not happy on CI server
public void testQueryJoin() {
LoggedSqlCollector.start();
DB.find(EBasicEncryptRelate.class)
.where().eq("other.description", "foo")
.findList();
DB.find(EBasicEncryptRelate.class)
.where().eq("other.description", "foo")
.findCount();
List<String> loggedSql = LoggedSqlCollector.stop();
assertThat(loggedSql).hasSize(2);
assertThat(loggedSql.get(0)).contains("left join e_basicenc t1 on t1.id = t0.other_id");
assertThat(loggedSql.get(1)).contains("left join e_basicenc t1 on t1.id = t0.other_id");
}
@Test
@ForPlatform(Platform.H2)
public void test() {