my pojo looks like this:
@Entity
@Table(name = "USERS")
public class User {
When I keep the name there, everything works, hibernate sql log:
create table users (id int8 not null, username varchar(255), primary key (id))
When I remove the annotation, I get :
Hibernate: create table user (id int8 not null, username varchar(255), primary key (id))
19:24:43 [localhost-startStop-23] ERROR o.h.tool.hbm2ddl.SchemaExport - HHH000389: Unsuccessful: create table user (id int8 not null, username varchar(255), primary key (id))
19:24:43 [localhost-startStop-23] ERROR o.h.tool.hbm2ddl.SchemaExport - ERROR: syntax error at or near "user" Position: 14
I am trying to use this, as it is defined in my xml:
<property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy" />
Any suggestions, why the namingstrategy isn’t working?
Default table name
USERis a reserved keyword. In this case you have to specifynameexplicitly in order to add necessary escaping to it: