ENH: native UUID-support for SqlServer

This commit is contained in:
Roland Praml
2018-03-02 01:14:42 +01:00
parent b642b3c644
commit 9953ef35eb
2 changed files with 7 additions and 0 deletions
@@ -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;
}