Hibernate generates column of type “numeric” in SQL Server for properties of type Long of Java class. Is there a way to make Hibernate generate bigint (or int) column instead of numeric using the Hibernate hbm2ddl?
+1
A:
Taken from the hibernate forums: https://forum.hibernate.org/viewtopic.php?p=2377674#2377674
Looks like you're going to have to roll your own SQL server dialect. While that doesn't seem right, there doesn't seem to be any action in hibernate's JIRA that makes me think this is fixed.
Oh, or it could be driver type. I'm not sure what driver you're using but jTDS appears to map Long to BigInt.
zmf
2010-02-09 15:44:49
Besides roll-your-own dialect, is there a way (maybe a hint in mappings) to tell hibernate what data type is should use for column?
Dan
2010-02-09 15:59:24
you could try a different driver, which are you using?
zmf
2010-02-09 16:21:49
i am using jtds
Dan
2010-02-09 16:45:18
By default, Hibernate maps long to the sql type bigint. But the SQL Server dialect subclasses the Sybase dialect which maps bigint to numeric(19,0). As suggested, just create MySQLServerDialect that extends SQLServerDialect with one line in the constructor (after super()) that does registerColumnType( Types.BIGINT, "bigint" );
Brian Deterling
2010-02-09 17:09:29