rohitghatol / spring-roo-addon-typical-security

Automatically exported from code.google.com/p/spring-roo-addon-typical-security
2 stars 0 forks source link

Entity name "User" not valid when using Postgres for backend. #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Change the persistence setup to POSTGRES:
2. persistence setup --provider HIBERNATE --database POSTGRES
3. Hibernate will generate the following DDL: 

create table user (id int8 not null, activation_date timestamp, activa
tion_key varchar(255), email_address varchar(255) not null unique, enabled 
bool, first_name varchar(255) not null, last_name varchar(255) not null, locked 
bool,  password varchar(255) not null, version int4, primary key (id))

What is the expected output? What do you see instead?
Postgres throws syntax error since "user" is reserved and is not a valid table 
name.

What version of the product are you using? On what operating system?
1.4 - 
http://spring-roo-addon-typical-security.googlecode.com/files/com.xsoftwarelabs.
spring.roo.addon.typicalsecurity-0.1.4.BUILD-SNAPSHOT.jar

Please provide any additional information below.

Is it possible to change the entity name to something like SystemUser or 
ApplicationUser or something that will not conflict with popular databases' 
reserved words?

Original issue reported on code.google.com by jeffery....@gmail.com on 18 Mar 2011 at 3:34

GoogleCodeExporter commented 9 years ago
I think you can create the "users" table instead of "user"

Original comment by sergiotr...@gmail.com on 6 Sep 2011 at 11:08

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
You must use the following sql in PostgreSQL:

CREATE TABLE "user"
(
   id bigint NOT NULL, 
   activation_date timestamp with time zone, 
   activation_key character varying(255), 
   email_address character varying(255) NOT NULL, 
   enabled boolean NOT NULL, 
   first_name character varying(255) NOT NULL, 
   last_name character varying(255) NOT NULL, 
   locked boolean NOT NULL, 
   password character varying(255) NOT NULL, 
   version integer NOT NULL, 
   CONSTRAINT pk_user PRIMARY KEY (id)
);

Original comment by sergiotr...@gmail.com on 15 Feb 2012 at 9:28