FIX: jsonRead of transient maps (#1389)

FIX: jsonRead of transient maps - to skip the read of start_array - Avoid error "Unexpected token start_object - expecting start_array "
This commit is contained in:
Roland Praml
2018-05-28 23:06:45 +12:00
committed by Rob Bygrave
parent 8ea86d6c6d
commit 5a7f24da5d
3 changed files with 11 additions and 3 deletions
@@ -7,7 +7,9 @@ import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.MapKeyColumn;
import javax.persistence.Transient;
import javax.persistence.Version;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -25,6 +27,9 @@ public class EcmPerson {
@Column(name = "number", length = 10)
Map<String, String> phoneNumbers = new LinkedHashMap<>();
@Transient
Map<String, String> transientPhoneNumbers;
@Version
long version;
@@ -5,6 +5,7 @@ import io.ebean.Ebean;
import org.ebeantest.LoggedSqlCollector;
import org.junit.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -137,6 +138,7 @@ public class TestElementCollectionBasicMap extends BaseTestCase {
}
private void jsonToFrom(EcmPerson foundFirst) {
foundFirst.transientPhoneNumbers = new HashMap<>();
String asJson = Ebean.json().toJson(foundFirst);
EcmPerson fromJson = Ebean.json().toBean(EcmPerson.class, asJson);