This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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: 49
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: what i will use in hbm when we use sequence at backend side ?
 
It's not a secret anymore!