diff --git a/src/main/java/io/ebean/config/dbplatform/DbPlatformTypeMapping.java b/src/main/java/io/ebean/config/dbplatform/DbPlatformTypeMapping.java index b26576247..c1c4896e3 100644 --- a/src/main/java/io/ebean/config/dbplatform/DbPlatformTypeMapping.java +++ b/src/main/java/io/ebean/config/dbplatform/DbPlatformTypeMapping.java @@ -119,8 +119,8 @@ public class DbPlatformTypeMapping { put(DbType.JSONCLOB, JSON_CLOB_PLACEHOLDER); put(DbType.JSONBLOB, JSON_BLOB_PLACEHOLDER); put(DbType.JSONVARCHAR, JSON_VARCHAR_PLACEHOLDER); - // use reasonable default of varchar(40) - ideally set via DatabasePlatform.configure(DbTypeConfig) - put(DbType.UUID, get(DbType.VARCHAR).withLength(40)); + // default to native UUID and override on platform configure() + put(DbType.UUID, UUID_NATIVE); } } @@ -200,7 +200,7 @@ public class DbPlatformTypeMapping { */ public void config(boolean nativeUuidType, ServerConfig.DbUuid dbUuid) { if (nativeUuidType && dbUuid.useNativeType()) { - put(DbType.UUID, UUID_NATIVE); + // native UUID already set by default } else if (dbUuid.useBinary()) { put(DbType.UUID, get(DbType.BINARY).withLength(16)); } else { diff --git a/src/main/java/io/ebean/config/dbplatform/sqlserver/SqlServer17Platform.java b/src/main/java/io/ebean/config/dbplatform/sqlserver/SqlServer17Platform.java index fd17bbe9f..e08de85ab 100644 --- a/src/main/java/io/ebean/config/dbplatform/sqlserver/SqlServer17Platform.java +++ b/src/main/java/io/ebean/config/dbplatform/sqlserver/SqlServer17Platform.java @@ -1,6 +1,8 @@ package io.ebean.config.dbplatform.sqlserver; import io.ebean.annotation.Platform; +import io.ebean.config.dbplatform.DbPlatformType; +import io.ebean.config.dbplatform.DbType; /** * Microsoft SQL Server platform - NVarchar UTF types and Sequence preference. @@ -11,6 +13,8 @@ public class SqlServer17Platform extends SqlServerBasePlatform { super(); this.platform = Platform.SQLSERVER17; this.columnAliasPrefix = null; + this.nativeUuidType = true; + this.dbTypeMap.put(DbType.UUID, new DbPlatformType("uniqueidentifier", false)); } }