Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

jpa generationtype sequence mysql

In Dec 2020, you still can’t use this strategy (SEQUENCE) with a MySQL database. 
It requires a database sequence, and MySQL doesn’t support this feature.

If you’re working with a MySQL database, you should always use 
GenerationType.IDENTITY. It uses an autoincremented database column and 
is the most efficient approach available. You can do that by annotating 
your primary key attribute with 
@GeneratedValue(strategy = GenerationType.IDENTITY).
Source by thorben-janssen.com #
 
PREVIOUS NEXT
Tagged: #jpa #generationtype #sequence #mysql
ADD COMMENT
Topic
Name
7+4 =