org.hibernate.tool.schema.spi.CommandAcceptanceException:
Error executing DDL
"create table user (user_name varchar(255) not null, user_email varchar(255), user_id varchar(255),
primary key (user_name))" via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.
accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-5.6.10.Final.jar:5.6.10.Final]
Caused by: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "user" at line 1, column 14.
Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: Encountered "user" at line 1, column 14.
Reason:
user is a reserved keyword, change the JPA Entity or make use of the @Table annotation and give a different name.
package com.example.demo;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "user_master") //eg. use of user_master
public class User { //or change this to something like UserEntity or UserMaster
@Id
private String userName;
private String userId;
private String userEmail;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserEmail() {
return userEmail;
}
public void setUserEmail(String userEmail) {
this.userEmail = userEmail;
}
}

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!