This discussion is archived
1 Reply Latest reply: May 21, 2013 11:39 AM by cdelahun RSS

Best way to implement auto increment in JPA.

1009582 Newbie
Currently Being Moderated
What is the best way to implement auto increment in JPA so that it will support all databases such as MySQL, MSSQL Server, Oracle etc. ? Or is there any way to set auto increment strategy in common place such as persistence.xml? Please help...
  • 1. Re: Best way to implement auto increment in JPA.
    cdelahun Pro
    Currently Being Moderated
    All JPA strategies require something (like a table or sequence object) be in the database, with table sequencing being the most portable, though EclipseLink does allow custom sequence stratgies where you could use something else, such as the UUID. Sequencing is described here described here with a custom UUID example shown here .


  • Correct Answers - 10 points
  • Helpful Answers - 5 points