From 9640e02b6a27086b9127828ea194d82ab0c7fc1b Mon Sep 17 00:00:00 2001 From: rob bygrave Date: Thu, 12 Sep 2019 16:58:15 +1200 Subject: [PATCH] #1817 - Rename @DbHstore to @DbMap --- pom.xml | 2 +- .../server/deploy/parse/AnnotationFields.java | 8 ++++---- .../server/deploy/parse/DeployCreateProperties.java | 4 ++-- .../io/ebeaninternal/server/deploy/parse/DeployUtil.java | 8 ++++---- .../io/ebeaninternal/server/type/DefaultTypeManager.java | 2 +- .../java/io/ebeaninternal/server/type/TypeManager.java | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index b9ae3f3e7..a460fc600 100644 --- a/pom.xml +++ b/pom.xml @@ -118,7 +118,7 @@ io.ebean ebean-annotation - 4.13 + 5.1 diff --git a/src/main/java/io/ebeaninternal/server/deploy/parse/AnnotationFields.java b/src/main/java/io/ebeaninternal/server/deploy/parse/AnnotationFields.java index 986dd0d92..36783a15f 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/parse/AnnotationFields.java +++ b/src/main/java/io/ebeaninternal/server/deploy/parse/AnnotationFields.java @@ -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) { diff --git a/src/main/java/io/ebeaninternal/server/deploy/parse/DeployCreateProperties.java b/src/main/java/io/ebeaninternal/server/deploy/parse/DeployCreateProperties.java index b32320ad7..bdaf79f44 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/parse/DeployCreateProperties.java +++ b/src/main/java/io/ebeaninternal/server/deploy/parse/DeployCreateProperties.java @@ -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); } diff --git a/src/main/java/io/ebeaninternal/server/deploy/parse/DeployUtil.java b/src/main/java/io/ebeaninternal/server/deploy/parse/DeployUtil.java index b8cafc39d..e63533364 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/parse/DeployUtil.java +++ b/src/main/java/io/ebeaninternal/server/deploy/parse/DeployUtil.java @@ -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); } diff --git a/src/main/java/io/ebeaninternal/server/type/DefaultTypeManager.java b/src/main/java/io/ebeaninternal/server/type/DefaultTypeManager.java index 24c11e2b0..9da7169dc 100644 --- a/src/main/java/io/ebeaninternal/server/type/DefaultTypeManager.java +++ b/src/main/java/io/ebeaninternal/server/type/DefaultTypeManager.java @@ -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); } diff --git a/src/main/java/io/ebeaninternal/server/type/TypeManager.java b/src/main/java/io/ebeaninternal/server/type/TypeManager.java index 9e6ca0d7b..9ecfc2cc6 100644 --- a/src/main/java/io/ebeaninternal/server/type/TypeManager.java +++ b/src/main/java/io/ebeaninternal/server/type/TypeManager.java @@ -68,5 +68,5 @@ public interface TypeManager { /** * Return the ScalarType used to handle HSTORE (Map). */ - ScalarType getHstoreScalarType(); + ScalarType getDbMapScalarType(); }