使用hsqldb做一个项目demo时,出现如下异常:
ERROR (SchemaExport.java:386) Unsuccessful: create table enterprise (id bigint not null, create_name varchar(40) not null, create_time timestamp not null, modified_name varchar(40) not null, modified_time timestamp not null, bus_mode varchar(40), eco_type varchar(40), email varchar(100), is_mkt bigint, leg_person varchar(40), leg_type varchar(40), name varchar(100) not null, reg_add varchar(100), reg_code varchar(40), reg_funds bigint, reg_office varchar(100), retail_cert varchar(40), retail_cert_date date, retail_cert_dept varchar(50), right varchar(40), rule varchar(500), safe_mgr varchar(40), safe_mgr_fax varchar(20), safe_mgr_tel varchar(20), site varchar(200), staff_num bigint, sup_dept varchar(100), tel varchar(20), zip_code varchar(10), reg_add_code varchar(255), primary key (id))
ERROR (SchemaExport.java:387) unexpected token: RIGHT
ERROR (SchemaExport.java:386) Unsuccessful: alter table enterprise add constraint FKD0273361FD4540CF foreign key (reg_add_code) references district (district_code)
ERROR (SchemaExport.java:387) user lacks privilege or object not found: ENTERPRISE
原因:使用的hsqldb的关键字做列名,将right修改为right_,避免列名与关键字冲突。
ERROR (SchemaExport.java:386) Unsuccessful: create table enterprise (id bigint not null, create_name varchar(40) not null, create_time timestamp not null, modified_name varchar(40) not null, modified_time timestamp not null, bus_mode varchar(40), eco_type varchar(40), email varchar(100), is_mkt bigint, leg_person varchar(40), leg_type varchar(40), name varchar(100) not null, reg_add varchar(100), reg_code varchar(40), reg_funds bigint, reg_office varchar(100), retail_cert varchar(40), retail_cert_date date, retail_cert_dept varchar(50), right varchar(40), rule varchar(500), safe_mgr varchar(40), safe_mgr_fax varchar(20), safe_mgr_tel varchar(20), site varchar(200), staff_num bigint, sup_dept varchar(100), tel varchar(20), zip_code varchar(10), reg_add_code varchar(255), primary key (id))
ERROR (SchemaExport.java:387) unexpected token: RIGHT
ERROR (SchemaExport.java:386) Unsuccessful: alter table enterprise add constraint FKD0273361FD4540CF foreign key (reg_add_code) references district (district_code)
ERROR (SchemaExport.java:387) user lacks privilege or object not found: ENTERPRISE
原因:使用的hsqldb的关键字做列名,将right修改为right_,避免列名与关键字冲突。