Jonathan Hernandez

Rails developer. Free (as in freedom) software enthusiast. Gamer.

MS SQLServer Numeric Primary Key Hibernate

| Comments

Related to this old hibernate problem:

By default Gorm/hiberate is generating id columns as the numeric(19,0) on SQLServer.  I’d like those to be of type BIGINT instead.

The solution is to use the correct dialect for hibernate. In Grails, you can configure it like this:


        dataSource {
            driverClassName = “”
            username = “xxx”
            password = “xxx”
            dbCreate = “create-drop” // one of ‘create’, ‘create-drop’, ‘update’, ‘validate’, ”
            url = “jdbc:sqlserver://host\instance;databaseName=databaseName”
            dialect = “org.hibernate.dialect.SQLServer2008Dialect”