-->
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.  [ 2 posts ] 
Author Message
 Post subject: Need help with auto generated primary keys and annotations
PostPosted: Tue Feb 05, 2008 8:27 am 
Newbie

Joined: Sat Feb 02, 2008 6:27 am
Posts: 2
Hi ,

We are currently eliminating the use of .hbm file and using annotated objects reverse engineered from the database using hibernate-tools

I want to use such a sequence generator with org.hibernate.annotations.GenericGenerator and prefer that it is automatically generated while the object is being reverse engineered.But I am not sure how to go about it.
[code]
<id
name="id"
column="ID"
type="long"
>
<generator class="native">
<param name="table">OGS_SEQUENCE</param>
<param name="column">NEXT</param>
<param name="sequence">HIBERNATE_SEQUENCE</param>
<param name="parameters">START WITH 1 INCREMENT BY 1</param>
</generator>
</id>[/code]

your thoughts and inputs are highly appreciated
Regards,
Mani Ananth


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 05, 2008 10:03 am 
Newbie

Joined: Mon Jun 11, 2007 1:34 pm
Posts: 11
I always use this on my IDs:
Code:
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

I don't know what kind of generator you want to use but here is some more explanation abaut @GeneratedValue uses
http://docs.jboss.org/ejb3/app-server/HibernateAnnotations/reference/en/html_single/index.html#mapping-identifier


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.