aspose file tools*
The moose likes Object Relational Mapping and the fly likes what i will use in hbm when we use sequence at backend side ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "what i will use in hbm when we use sequence at backend side ?" Watch "what i will use in hbm when we use sequence at backend side ?" New topic
Author

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

shyam ji gautam
Ranch Hand

Joined: Sep 17, 2011
Posts: 48
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

Joined: Jun 16, 2006
Posts: 19
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what i will use in hbm when we use sequence at backend side ?