I make a project like this: https://grokonez.com/spring-framework/spring-boot/use-spring-jpa-mysql-spring-boot and run normally
But when I change "id" with column(name="id") in MYSQL . I have an error when the test on the postman.
{
"timestamp": 1533183310810,
"status": 500,
"error": "Internal Server Error",
"exception": "org.springframework.transaction.UnexpectedRollbackException",
"message": "JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.",
"path": "/save"
}
I change something class Customer :
@Id
@Column(name="id")
private long id;
public Customer(long id , String firstName, String lastName){
this.id=id;
this.firstName=firstName;
this.lastName=lastName;
}
In class WebController, I save a customer with id, first name, last name
@RequestMapping("/save")
public String process(){
repository.save(new Customer(1,"Jack", "Smith"));
return "Done";
}
How to save a customer with id?