Results 1 to 5 of 5
- 12-10-2011, 05:57 AM #1
Member
- Join Date
- Dec 2011
- Posts
- 3
- Rep Power
- 0
Primary key generation in jpa : sequence type.
Hi All,
I am Dheepan. Whenever i am generating primary key using @GeneratedValue and @Sequencegenerator,
It is creating just random numbers instead of creating the sequence number as specified.. and some of
my friends says that it will be generated in mySql but not in sql plus... Can somebody tell me why it is not
creating the sequence numbers in sqlPlus? -Thanks in advance
- 12-10-2011, 06:07 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,609
- Rep Power
- 5
Re: Primary key generation in jpa : sequence type.
Cross posted at Jpa Primary key generation
- 12-12-2011, 09:31 AM #3
Member
- Join Date
- Dec 2011
- Posts
- 3
- Rep Power
- 0
Re: Primary key generation in jpa : sequence type.
Since I am new to this forum i dont know the rules.. what should i do now?
- 12-12-2011, 03:32 PM #4
Member
- Join Date
- May 2011
- Posts
- 27
- Rep Power
- 0
Re: Primary key generation in jpa : sequence type.
@GeneratedValue(strategy=GenerationType.SEQUENCE)
it will generate the sequence values.
- 12-13-2011, 05:50 AM #5
Member
- Join Date
- Dec 2011
- Posts
- 3
- Rep Power
- 0
Re: Primary key generation in jpa : sequence type.
Thanks for your reply dinesh,
I have used that syntax only.
@GeneratedValue(strategy=GenerationType.SEQUENCE,g enerator="dheepan")
@SequenceGenerator(initialValue=1,allocationSize=1 , name = "dheepan", sequenceName="dheepan")
This is what i did. It should start from 1 and go on 2,3,4... like that in a sequence order .. but the numbers that are created was,
401,0,52,273 like this it is creating some random numbers... It is on sql plus server..I heard that for MySql it is creating the exact values.. But i dont know why it is not working in sql plus? I am using sql plus..
Similar Threads
-
JPA Primary Key from two foreign key
By peterbo in forum New To JavaReplies: 4Last Post: 10-23-2010, 03:34 PM -
Linked list sequence and array sequence
By Predz in forum New To JavaReplies: 1Last Post: 12-31-2009, 01:30 AM -
JPA Composite Primary Key
By The_S in forum Advanced JavaReplies: 2Last Post: 02-06-2009, 06:30 AM -
How to generate primary key in EJB
By naresh_m in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 07-17-2008, 09:41 AM -
how to determine the primary key
By osval in forum JDBCReplies: 1Last Post: 08-07-2007, 02:31 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks