• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what i will use in hbm when we use sequence at backend side ?

 
shyam ji gautam
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all

let us suppose i create a table in oracle in which one colunm is primary key called empid whcih gets value by using sequence in oracle.


so when i create .hbm file for this table using hybernate so my doubt is that i will use here

<id name="userId" type="string">
<column name="USER_ID" length="256" />
<generator class="assigned" />
</id>


means generator class assigned use or another because here we generate primary key by using sequence in oracle like auto increment


thanks
 
Justin Yao
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shyam ji gautam wrote:Dear all

let us suppose i create a table in oracle in which one colunm is primary key called empid whcih gets value by using sequence in oracle.


so when i create .hbm file for this table using hybernate so my doubt is that i will use here

<id name="userId" type="string">
<column name="USER_ID" length="256" />
<generator class="assigned" />
</id>


means generator class assigned use or another because here we generate primary key by using sequence in oracle like auto increment


thanks


use it like this
<id name="id" type="long" column="ID">
<generator class="sequence"/>
</id>

By the way, you can read the hibernate reference first next time
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic