Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPA uses MySQL reserved KEY keyword #50

Closed
immno opened this issue Jan 24, 2018 · 1 comment
Closed

JPA uses MySQL reserved KEY keyword #50

immno opened this issue Jan 24, 2018 · 1 comment
Assignees
Labels

Comments

@immno
Copy link

immno commented Jan 24, 2018

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'varchar(255) not null, expiration datetime, remaining bigint, remaining_quota bi' at line 1
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_101]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_101]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_101]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_101]

I know the reason, because of the use of the MySQL keyword key.
I revise as follows:

create table rate (key2 varchar(255) not null, expiration datetime, remaining bigint, remaining_quota bigint, reset bigint, primary key (key2))

It can run.
I use MySql version 5.7.20.
image

MySQL Keywords reference

@marcosbarbero marcosbarbero self-assigned this Jan 24, 2018
@marcosbarbero
Copy link
Owner

@immno nice catch!

@marcosbarbero marcosbarbero changed the title Jpa has an error in your SQL syntax.[bug] JPA uses MYSQL reserved KEY keyword Jan 24, 2018
@marcosbarbero marcosbarbero changed the title JPA uses MYSQL reserved KEY keyword JPA uses MySQL reserved KEY keyword Jan 24, 2018
@immno immno closed this as completed Jan 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants