playframework / playframework/play1
mysql primary key can not auto_increment
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.6k
- Forks
- 671
- Avg merge
- 12d 15h
- Merged PRs (30d)
- 1
Description
I am using a MySQL database. The table I created is self-growth. The mapped java entity inherits the play.db.jpa.Model class, but when I call the .save() method to save it to the database, The primary key ID is generated by hibernate_sequence, not by the table AUTO_INCREMENT.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with a MySQL table using AUTO_INCREMENT and a Java entity inheriting play.db.jpa.Model. Inspect how save() selects the identifier generator and compare the generated hibernate_sequence value with the table's AUTO_INCREMENT behavior. Done means saving the entity uses the table's auto-generated primary key and populates the mapped ID correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mysql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100