Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JPA reserved keywords to postgres

I'm using JPA with a postgres DBMS and I'm trying to create a new entity that maps to the table "User".

This is a very common problem as User is a reserved word in Postgres. My question is, how can i "escape" the reserved keyword or set JPA to escape it?

I tried @Table(name = "\"user\"") with no luck:

2009-02-25 15:43:14,218 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] Unsuccessful: create table "User"_Module (users_login varchar(100) not null, modules_id int8 not null)

like image 372
AlfaTeK Avatar asked Dec 06 '25 06:12

AlfaTeK


1 Answers

Use:

@Table(name = "`user`")

and it works...

like image 54
AlfaTeK Avatar answered Dec 07 '25 18:12

AlfaTeK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!