Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

primary key

 
Popescu Ion
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
I'm using OpenJPA. Have a entity named "catalog", and every time I'm working with it, I delete then repopulate the table with fresh new data.
Question : what is the command for setting primary key back to "1" every time I'm deleting data within table ?

Example :

id name description
1 someName1 someDescription1
2 someName2 someDescription2
3 someName3 someDescription3

Then, after deleting and repopulating, i got this :


id name description
4 someName1 someDescription1
5 someName2 someDescription2
6 someName3 someDescription3

How to set this id to start every time on "1".
Thnx in advance and sorry for my bad english.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A question worth considering is why do you want to do this? What purpose does the "1" serve if it has the same meaning as the lowest id? I'm asking because resetting the key adds a degree of complexity to no real benefit (unless you have a compelling argument for it?)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic