-->
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: to generate formular primary key
PostPosted: Mon Aug 29, 2005 4:03 am 
Newbie

Joined: Mon Aug 29, 2005 3:48 am
Posts: 1
I have a table named "test" under DB2
table test
id identity integer
aid formular 'a'||char(id) parmary key
name character(10)

when I ran the sql follows:
insert into test(name) values('name')

if id is generated to 2,the column must be 'a2'

column id is not exist in my hbm file now(because it is identitied).Here is my hbm file:
<class name="test" table="ADMINISTRATOR.test">
<id name="aid" column="AID" type="string">
<generator class="native"/>
</id>

<!--<property name="id" column="ID" type="integer" not-null="true" />-->
<property name="name" column="NAME" type="string" not-null="true" />

</class>

when I create an new object Test and saved by a instance
of Session, I get the attribute aid of value 2(it the value of column id but not column aid).My question is how can I make the hbm file that I can save an new object Test and get the attribute aid start by 'a'


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.