-
-
Save ochoto/1688362 to your computer and use it in GitHub Desktop.
Improved MSSQL dialect for Hibernate (using more appropriate data types)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright © 2009, Componentix. All rights reserved. | |
*/ | |
package com.componentix.hibernate.dialect; | |
import java.sql.Types; | |
/** | |
* A proper dialect for Microsoft SQL Server 2000 and 2005. | |
* | |
* @author Yuri Sakhno (George1) | |
*/ | |
public class SQLServerDialect extends org.hibernate.dialect.SQLServerDialect { | |
/** | |
* Initializes a new instance of the {@link SQLServerDialect} class. | |
*/ | |
public SQLServerDialect() { | |
registerColumnType(Types.BIGINT, "bigint"); | |
registerColumnType(Types.BIT, "bit"); | |
registerColumnType(Types.CHAR, "nchar(1)"); | |
registerColumnType(Types.VARCHAR, 4000, "nvarchar($l)"); | |
registerColumnType(Types.VARCHAR, "nvarchar(max)"); | |
registerColumnType(Types.VARBINARY, 4000, "varbinary($1)"); | |
registerColumnType(Types.VARBINARY, "varbinary(max)"); | |
registerColumnType(Types.BLOB, "varbinary(max)"); | |
registerColumnType(Types.CLOB, "nvarchar(max)"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment