-->
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: @GeneratedValue(strategy = GenerationType.AUTO)
PostPosted: Fri Dec 20, 2013 12:16 pm 
Newbie

Joined: Fri Dec 20, 2013 12:05 pm
Posts: 1
So how exactly does the auto generate function "@GeneratedValue(strategy = GenerationType.AUTO)" work?

I'm brand new to Hibernate and have inherited a project that uses is extensively. The java object has:

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="ID")
private Long id;

When I create a new entity of this type, the ID is generated. Subsequent new entities have IDs incremented by 2. Where exactly is this done?

Also, it generates different IDs on our DEV and TEST environments, so somehow it is database specific. Is there a 'feeder' table/view/sequence or something?

For example, if I wanted the generated IDs to start being 100,000,XXX as opposed to 10,XXX, how would I go about making that change?

Please help out a noob. Thanks in advance.


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.