mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
ENH: native UUID-support for SqlServer
This commit is contained in:
@@ -31,6 +31,7 @@ public class SqlServerPlatform extends DatabasePlatform {
|
||||
this.sqlLimiter = new SqlServerSqlLimiter();
|
||||
this.basicSqlLimiter = new SqlServerBasicSqlLimiter();
|
||||
this.historySupport = new SqlServerHistorySupport();
|
||||
this.nativeUuidType = true;
|
||||
this.dbIdentity.setIdType(IdType.IDENTITY);
|
||||
this.dbIdentity.setSupportsGetGeneratedKeys(true);
|
||||
this.dbIdentity.setSupportsIdentity(true);
|
||||
@@ -83,6 +84,9 @@ public class SqlServerPlatform extends DatabasePlatform {
|
||||
if (dbIdentity.getIdType() == IdType.SEQUENCE) {
|
||||
this.persistBatchOnCascade = PersistBatch.ALL;
|
||||
}
|
||||
if (nativeUuidType && config.getDbTypeConfig().getDbUuid().useNativeType()) {
|
||||
dbTypeMap.put(DbType.UUID, new DbPlatformType("uniqueidentifier", false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,9 @@ public class ScalarTypeUUIDNative extends ScalarTypeUUIDBase {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof String) {
|
||||
return UUID.fromString((String) value);
|
||||
}
|
||||
return (UUID) value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user