mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1318 - ENH: native UUID-support for SqlServer
Merge branch 'native-uuid-sqlserver' of https://github.com/FOCONIS/ebean into FOCONIS-native-uuid-sqlserver # Conflicts: # src/main/java/io/ebean/config/dbplatform/sqlserver/SqlServerBasePlatform.java
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user