SEARCH BY

All

  • All
  • Java8
  • Spring

500 error in Spring Boot JPA Create or Saving record application

Post a Comment
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;
jaya
I love software designing, coding, writing and teaching...

Share this article

Related Posts

Post a Comment

Place your code in <em> </em> tags to send in comments | Do not add hyper links in commnet

Close

Subscribe our newsletter for the latest articles directly into your email inbox