Here iam trying to share my experience about the reason of error 500 in Spring Boot JPA application while saving new record. Here iam not sharing my complete code, but ima trying to show what the mistake i done and the solution to resolve error 500.
But intrestings my application is working in embeded tomcat server ( which comes with Spring Boot ) , but after moving to hosting tomcat server ( which is in a production server ) , application returing
internal server error 500.
While creating ID with in the entity class , i have used
@GeneratedValue(strategy = GenerationType.AUTO) for my autoincrement primary key, it is working in embeded tomcat, but as i said it is returing 500 error in a production server...To resolve the issue i have used
@GeneratedValue(strategy = GenerationType.IDENTITY) instread of GenerationType.AUTO.
Mistkae in code leads to error 500
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
int gid;
Correct code
The following is the corrected code to resolve error 500
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
int gid;
Post a Comment
Post a Comment