#1817 - Rename @DbHstore to @DbMap

This commit is contained in:
rob bygrave
2019-09-12 16:58:15 +12:00
parent 8a0ef33f79
commit 9640e02b6a
6 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -118,7 +118,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-annotation</artifactId>
<version>4.13</version>
<version>5.1</version>
</dependency>
<dependency>
@@ -5,7 +5,7 @@ import io.ebean.annotation.CreatedTimestamp;
import io.ebean.annotation.DbArray;
import io.ebean.annotation.DbComment;
import io.ebean.annotation.DbDefault;
import io.ebean.annotation.DbHstore;
import io.ebean.annotation.DbMap;
import io.ebean.annotation.DbJson;
import io.ebean.annotation.DbJsonB;
import io.ebean.annotation.DbMigration;
@@ -246,9 +246,9 @@ public class AnnotationFields extends AnnotationParser {
if (comment != null) {
prop.setDbComment(comment.value());
}
DbHstore dbHstore = get(prop, DbHstore.class);
if (dbHstore != null) {
util.setDbHstore(prop, dbHstore);
DbMap dbMap = get(prop, DbMap.class);
if (dbMap != null) {
util.setDbMap(prop, dbMap);
}
DbJson dbJson = get(prop, DbJson.class);
if (dbJson != null) {
@@ -2,7 +2,7 @@ package io.ebeaninternal.server.deploy.parse;
import io.ebean.Model;
import io.ebean.annotation.DbArray;
import io.ebean.annotation.DbHstore;
import io.ebean.annotation.DbMap;
import io.ebean.annotation.DbJson;
import io.ebean.annotation.DbJsonB;
import io.ebean.annotation.UnmappedJson;
@@ -274,7 +274,7 @@ public class DeployCreateProperties {
return (AnnotationUtil.findAnnotation(field, DbJson.class) != null)
|| (AnnotationUtil.findAnnotation(field, DbJsonB.class) != null)
|| (AnnotationUtil.findAnnotation(field, DbArray.class) != null)
|| (AnnotationUtil.findAnnotation(field, DbHstore.class) != null)
|| (AnnotationUtil.findAnnotation(field, DbMap.class) != null)
|| (AnnotationUtil.findAnnotation(field, UnmappedJson.class) != null);
}
@@ -1,7 +1,7 @@
package io.ebeaninternal.server.deploy.parse;
import io.ebean.annotation.DbArray;
import io.ebean.annotation.DbHstore;
import io.ebean.annotation.DbMap;
import io.ebean.annotation.DbJson;
import io.ebean.annotation.DbJsonB;
import io.ebean.annotation.DbJsonType;
@@ -171,15 +171,15 @@ public class DeployUtil {
/**
* Map to Postgres HSTORE type (with fallback to JSON storage in VARCHAR).
*/
void setDbHstore(DeployBeanProperty prop, DbHstore dbHstore) {
void setDbMap(DeployBeanProperty prop, DbMap dbMap) {
ScalarType<?> scalarType = typeManager.getHstoreScalarType();
ScalarType<?> scalarType = typeManager.getDbMapScalarType();
int dbType = scalarType.getJdbcType();
prop.setDbType(dbType);
prop.setScalarType(scalarType);
if (dbType == Types.VARCHAR) {
// this is actually the fallback of JSON storage into VARCHAR
int dbLength = dbHstore.length();
int dbLength = dbMap.length();
int columnLength = (dbLength > 0) ? dbLength : DEFAULT_JSON_VARCHAR_LENGTH;
prop.setDbLength(columnLength);
}
@@ -349,7 +349,7 @@ public final class DefaultTypeManager implements TypeManager {
}
@Override
public ScalarType<?> getHstoreScalarType() {
public ScalarType<?> getDbMapScalarType() {
return (postgres) ? hstoreType : ScalarTypeJsonMap.typeFor(false, Types.VARCHAR);
}
@@ -68,5 +68,5 @@ public interface TypeManager {
/**
* Return the ScalarType used to handle HSTORE (Map<String,String>).
*/
ScalarType<?> getHstoreScalarType();
ScalarType<?> getDbMapScalarType();
}