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

This commit is contained in:
rob bygrave committed 2019-11-06 20:33:56 +13:00
1 parent d2c88bf7c6
commit 1a8a43603e
3 files changed
+69 -1

No files matched your search

@@ -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() {
@@ -0,0 +1,47 @@
package org.tests.model.basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "e_basicenc_relate")
public class EBasicEncryptRelate {
@Id
private long id;
private String name;
@ManyToOne
private EBasicEncrypt other;
public EBasicEncryptRelate(String name) {
this.name = name;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public EBasicEncrypt getOther() {
return other;
}
public void setOther(EBasicEncrypt other) {
this.other = other;
}
}