views:

387

answers:

1

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)

+2  A: 

Use:

@Table(name = "`user`")

and it works...

AlfaTeK
I had the same problem and you saved me. Thanks!
elnur