-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: SchemaUpdate-updating a table to include an identity column
PostPosted: Tue Nov 02, 2004 3:01 am 
Newbie

Joined: Tue Nov 02, 2004 2:37 am
Posts: 3
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:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.