I am new to Spring
framework and trying to implement a simple CRUD
application in spring boot
with MySQL
as database. Everything is working fine.
I have the Auto Increment
enabled on Id
field in the database. I am using EntityManager.persist()
method to save the data in database and it is working fine. Now I want to return the auto generated
Id back to the client as response of POST
method but EntityManager.persist()
return type is void
.
Can anyone help me that how I can return the Id back?