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;
}
}
More Posts related to Java,
- Get the current timestamp in Java
- Java Stream with Multiple Filters Example
- Java SE JDBC with Prepared Statement Parameterized Select Example
- Fix: UnsupportedClassVersionError: Unsupported major.minor version 63.0
- [Fix] Java Exception with Lambda - Cannot invoke because object is null
- 7 deadly java.lang.OutOfMemoryError in Java Programming
- How to Calculate the SHA Hash Value of a File in Java
- Java JDBC Connection with Database using SSL (https) URL
- How to Add/Subtract Days to the Current Date in Java
- Create Nested Directories using Java Code
- Spring Boot: JDBCTemplate BatchUpdate Update Query Example
- What is CA FE BA BE 00 00 00 3D in Java Class Bytecode
- Save Java Object as JSON file using Jackson Library
- Adding Custom ASCII Text Banner in Spring Boot Application
- [Fix] Java: Type argument cannot be of primitive type generics
- List of New Features in Java 11 (JEPs)
- Java: How to Add two Maps with example
- Java JDBC Transition Management using PreparedStatement Examples
- Understanding and Handling NullPointerException in Java: Tips and Tricks for Effective Debugging
- Steps of working with Stored Procedures using JDBCTemplate Spring Boot
- Java 8 java.util.Function and BiFunction Examples
- The Motivation Behind Generics in Java Programming
- Get Current Local Date and Time using Java 8 DateTime API
- Java: Convert Char to ASCII
- Deep Dive: Why avoid java.util.Date and Calendar Classes
More Posts:
- 5 Reasons Why Jupyter Notebook is Not Opening and Solutions - Python
- [fix] zsh: illegal hardware instruction python TensorFlow M1/M2 Mac - zsh
- Find Sum of two numbers - C-Program
- How to add Solver Add-in in Microsoft Excel on Mac - Windows
- [fix] Docker Desktop App not starting on Mac (macOS) - Docker
- How to deep copy a dictionary in Python - Python
- Auto Refresh Webpage after every x Second or Minute using Meta Tag? - Html
- How to know which version of macOS Sonoma you are using - MacOS