0

When I save a new entity on a MariaDB database with the PK and another field auto generated by the database, the entity is persisted correctly but the instance returned by Hibernate has inverted the value.

Thanks for the help

Example code 1:

enter your code here

Example code 2:

enter your code here
FanoFN
  • 6,815
  • 2
  • 13
  • 33
Cedric
  • 1
  • 1
  • 1
    Please don't post text/code as images but post the text itself (and format it nicely). – Thomas Jun 23 '21 at 12:28
  • `@GeneratedValue` only works on `@Id` columns it doesn't work for other columns. So your code is just not going to work. So what you see is what you should expect (id being filled, number not). – M. Deinum Jun 23 '21 at 12:38
  • Sorry, I try to modify the post correctly but editor refused to save : "Your post appears to contain code that is not properly formatted as code" – Cedric Jun 23 '21 at 12:52
  • Try inserting the code using that format @Cedric – FanoFN Jun 24 '21 at 03:24

0 Answers0