Hello,
My apologies if this is an FAQ or know problem. I'm trying to use SchemaUpdate to add an identity column for Hibernate against an existing SQL Server database. When I run SchemaUpdate it creates the new column (hid), however it does not specify that it is an identity column. The SQL being logged is:
Code:
alter table Address add hid numeric(19,0)
However, using the same mapping document, if the table does not exist, Hibernate creates the column as expected, using the following SQL:
Code:
create table Address (hid numeric(19,0) identity not null, objectVersion numeric(19,0) not null, address1 varchar(255) null, primary key (hid))
Thanks in advance,
Andrew
Hibernate version: 2.1.6
Mapping documents:
<hibernate-mapping>
<class
name="com.xyz.test.Address"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="hid"
type="java.lang.Long"
>
<generator class="native">
</generator>
</id>
<version
name="objectVersion"
type="long"
column="objectVersion"
access="property"
unsaved-value="undefined"
/>
<property
name="address1"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="address1"
/>
</class>
</hibernate-mapping>
Name and version of the database you are using:
SQL Server
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: