1 /*
2 * (C) Copyright 1989-2012 Trend Micro, Inc.
3 * All Rights Reserved.
4 *
5 * This program is an unpublished copyrighted work which is proprietary
6 * to Trend Micro, Inc. and contains confidential information that is not
7 * to be reproduced or disclosed to any other person or entity without
8 * prior written consent from Trend Micro, Inc. in each and every instance.
9 *
10 * WARNING: Unauthorized reproduction of this program as well as
11 * unauthorized preparation of derivative works based upon the
12 * program or distribution of copies by sale, rental, lease or
13 * lending are violations of federal copyright laws and state trade
14 * secret laws, punishable by civil and criminal penalties.
15 */
16
17 package com.trendmicro.grid.acl.mssql;
18
19 import org.hibernate.Hibernate;
20 import org.hibernate.dialect.SQLServer2005Dialect;
21 import org.hibernate.dialect.SQLServer2008Dialect;
22 import org.hibernate.dialect.function.NoArgSQLFunction;
23
24 import java.sql.Types;
25
26 /**
27 * Dialect for MSSQL-2008 with support for Unicode field types.
28 *
29 * @author snake, juergen_kellerer, 2012-02-15
30 */
31 public class MSSQL2008Dialect extends SQLServer2008Dialect {
32
33 public MSSQL2008Dialect() {
34 super();
35
36 // Adding support for the XML column type
37 registerColumnType(Types.SQLXML, "xml");
38
39 // Adding support for unicode columns
40 registerColumnType(Types.NCLOB, "nvarchar(MAX)");
41 registerColumnType(Types.NVARCHAR, "nvarchar(MAX)"); // set field-type default for NVARCHAR to nvarchar(MAX)
42 registerColumnType(Types.NVARCHAR, 4000, "nvarchar($l)"); // override default for field lengths <= 4000
43 }
44 }