Jpa Primary key generation
Hi All,
I am using sql plus. whenever i am creating primary key with @generatedValue and @SequenceGenerator annotations .. it is not creating the sequence numbers... instead it creates
random number like generation type.AUTO.. can anybody tell why it is happening?
Re: Jpa Primary key generation
Re: Jpa Primary key generation
Okay I understood the rules clearly, since i am new to this forum i did like that.. Can anybody Help me on this question?
Re: Jpa Primary key generation
What is the data type of the field you trying to generate Primary Key for?
Re: Jpa Primary key generation
Hi,
thanks for replying..
The data type is Integer..
and the exact syntax i've written is,
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE,g enerator="xyz")
@SequenceGenerator(initialValue=1,allocationSize=1 , name = "xyz", sequenceName="xyz")
private int id;
It should generate the sequence like 1,2,3... But actually it is creating the random numbers like 32,0,273,52,401..
But my friends are telling that it will work fine with mySql .. But for sql plus it is not working...
Re: Jpa Primary key generation
I can not say what exactly is the problem but i will recommend you to follow this as this might be helpful for you.
ID Generation Type: SEQUENCE : Generated IDJPAJava Tutorial