#900 - Error - Can't fetch JsonDB field - org.postgresql.util.PSQLException: ERROR: could not identify an equality operator for type json

This commit is contained in:
Rob Bygrave
2016-12-20 03:00:08 +13:00
parent 84e1e12b66
commit bc93a82b1a
3 changed files with 151 additions and 0 deletions
@@ -0,0 +1,63 @@
package io.ebeaninternal.server.query;
import org.junit.Test;
import static org.junit.Assert.*;
public class SqlTreeBuilderTest {
@Test
public void mergeOnDistinct_equal() throws Exception {
assertEquals(SqlTreeBuilder.mergeOnDistinct("t0.id", "t0.id"), "t0.id");
}
@Test
public void mergeOnDistinct_add() throws Exception {
assertEquals(SqlTreeBuilder.mergeOnDistinct("t0.id", "t0.cre"), "t0.cre, t0.id");
}
@Test
public void mergeOnDistinct_contained() throws Exception {
assertEquals(SqlTreeBuilder.mergeOnDistinct("t0.id", "t0.cre, t0.id"), "t0.cre, t0.id");
}
@Test
public void mergeOnDistinct_overlap() throws Exception {
assertEquals(SqlTreeBuilder.mergeOnDistinct("t0.id, t1.id", "t0.cre, t0.id"), "t0.cre, t0.id, t1.id");
}
@Test
public void mergeOnDistinct_overlapBoth() throws Exception {
assertEquals(SqlTreeBuilder.mergeOnDistinct("t0.id, t1.id", "t0.cre, t1.id, t0.id"), "t0.cre, t1.id, t0.id");
}
@Test
public void mergeOnDistinct_inlineAscDesc() throws Exception {
assertEquals(SqlTreeBuilder.mergeOnDistinct("t0.id", "t0.cre asc, t1.bb desc, t3.b"), "t0.cre, t1.bb, t3.b, t0.id");
}
@Test
public void mergeOnDistinct_inlineAscDesc2() throws Exception {
assertEquals(SqlTreeBuilder.mergeOnDistinct("t0.id", "t0.cre desc, t1.bb asc, t3.b"), "t0.cre, t1.bb, t3.b, t0.id");
}
@Test
public void mergeOnDistinct_trailingAsc() throws Exception {
assertEquals(SqlTreeBuilder.mergeOnDistinct("t0.id", "t0.cre asc"), "t0.cre, t0.id");
}
@Test
public void mergeOnDistinct_trailingDesc() throws Exception {
assertEquals(SqlTreeBuilder.mergeOnDistinct("t0.id", "t0.cre desc"), "t0.cre, t0.id");
}
}
@@ -0,0 +1,71 @@
package org.tests.model.json;
import io.ebean.annotation.DbJson;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Version;
import java.util.Map;
@Entity
public class EBasicJsonMapDetail {
@Id
Long id;
@ManyToOne
EBasicJsonMap owner;
@Version
Long version;
String name;
@DbJson
Map<String, Object> content;
public EBasicJsonMapDetail(String name) {
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getVersion() {
return version;
}
public void setVersion(Long version) {
this.version = version;
}
public EBasicJsonMap getOwner() {
return owner;
}
public void setOwner(EBasicJsonMap owner) {
this.owner = owner;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, Object> getContent() {
return content;
}
public void setContent(Map<String, Object> content) {
this.content = content;
}
}