-->
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.  [ 3 posts ] 
Author Message
 Post subject: Default value for primary key column
PostPosted: Wed Sep 01, 2010 8:06 am 
Newbie

Joined: Thu Jul 08, 2010 3:54 am
Posts: 4
I am using SQL server 2005.
I have a table column col1 which is auto increment column. Another column col2 is the primary key column. I have created a default like -
CREATE DEFAULT def AS convert(varchar,IDENT_CURRENT('col1'))+'XX'
How can I map such a table definition in hbm file?


Top
 Profile  
 
 Post subject: Re: Default value for primary key column
PostPosted: Wed Sep 01, 2010 8:09 am 
Regular
Regular

Joined: Sun Feb 14, 2010 3:29 pm
Posts: 58
Location: USA
See http://docs.jboss.org/hibernate/stable/core/reference/en/html_single/#mapping-declaration-id.

_________________
Zemian Deng
------------
Need a Java Scheduler? Try
http://bitbucket.org/timemachine/scheduler


Top
 Profile  
 
 Post subject: Re: Default value for primary key column
PostPosted: Wed Sep 01, 2010 9:18 am 
Newbie

Joined: Thu Jul 08, 2010 3:54 am
Posts: 4
Thanks for your reply.

I don't understand how to insert the default value into the prmary key column.

I am using like -

<id name="pkey" column="col2"><generator class="native"/> </id>
<property name="someproperty" column="col1" insert="false" update="false" />

Where col1 is auto increment column, col2 is PK.


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

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.