#589 - ElasticSearch - JsonReader given BeanType

This commit is contained in:
Robin Bygrave committed 2016-03-07 16:27:16 +13:00
1 parent f082fce1ff
commit 32bcd5e853
3 files changed
+28 -2

No files matched your search

@@ -5,7 +5,6 @@ import com.avaje.ebean.bean.EntityBean;
import com.avaje.ebean.config.EncryptKey;
import com.avaje.ebean.config.dbplatform.DbEncryptFunction;
import com.avaje.ebean.config.dbplatform.DbType;
import com.avaje.ebeaninternal.server.type.ScalarTypeEnum;
import com.avaje.ebeanservice.docstore.api.mapping.DocMappingBuilder;
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyMapping;
import com.avaje.ebean.plugin.Property;
@@ -1319,7 +1318,7 @@ public class BeanProperty implements ElPropertyValue, Property {
DocPropertyType type = scalarType.getDocType();
DocPropertyOptions options = docOptions.copy();
if (id || DocPropertyType.ENUM == type) {
if (DocPropertyType.ENUM == type || isStringId(type)) {
options.setCode(true);
}
@@ -1327,4 +1326,11 @@ public class BeanProperty implements ElPropertyValue, Property {
}
}
/**
* Return true if this is a String Id property and should be treated as a code by the document store.
*/
private boolean isStringId(DocPropertyType type) {
return DocPropertyType.STRING == type && id;
}
}