| 发表于:2008-01-19 11:05:237楼 得分:0 |
自己摸索了半天,pojo出来了。 问题又来了。 1 mvn appfuse:gen 一次只能做一次,有什么办法能一次全部做完? 2 单独的一张表,做起来没问题。如果有n个表,而且这些表还有1对多,多对多的关系。就要出错了。 h:\appfuse2_test> mvn jetty:run-war [info] scanning for projects... [info] searching repository for plugin with prefix: 'jetty'. [info] ------------------------------------------------------------------------ [info] building appfuse struts 2 application [info] task-segment: [jetty:run-war] [info] ------------------------------------------------------------------------ [info] preparing jetty:run-war [info] [aspectj:compile {EXECution: default}] [info] [native2ascii:native2ascii {EXECution: native2ascii-utf8}] [info] [native2ascii:native2ascii {EXECution: native2ascii-8859_1}] [info] [resources:resources] [info] using default encoding to copy filtered resources. [info] [compiler:compile] [info] nothing to compile - all classes are up to date [info] [resources:testresources] [info] using default encoding to copy filtered resources. [info] preparing hibernate3:hbm2ddl [warning] removing: hbm2ddl from forked lifecycle, to prevent recursive invocation. [info] [aspectj:compile {EXECution: default}] [info] [native2ascii:native2ascii {EXECution: native2ascii-utf8}] [info] [native2ascii:native2ascii {EXECution: native2ascii-8859_1}] [info] [resources:resources] [info] using default encoding to copy filtered resources. [info] [hibernate3:hbm2ddl {EXECution: default}] [info] configuration xml file loaded: h:\appfuse2_test\src\main\resources\hibernate.cfg.xm l [info] configuration xml file loaded: h:\appfuse2_test\src\main\resources\hibernate.cfg.xm l [info] configuration properties file loaded: h:\appfuse2_test\target\classes\jdbc.properti es alter table user_role drop foreign key fk143bf46a7c4d7a42; alter table user_role drop foreign key fk143bf46a21783e22; drop table if exists app_user; drop table if exists role; drop table if exists user_role; create table app_user (id bigint not null auto_increment, username varchar(50) not null un ique, email varchar(255) not null unique, password_hint varchar(255), first_name varchar(5 0) not null, last_name varchar(50) not null, phone_number varchar(255), website varchar(25 5), account_expired bit not null, account_locked bit not null, credentials_expired bit not null, city varchar(50) not null, province varchar(100), postal_code varchar(15) not null, address varchar(150), country varchar(100), account_enabled bit, version integer, passwor d varchar(255) not null, primary key (id)) engine=innodb; error [main] schemaexport.create(274) ¦ unsuccessful: create table app_user (id bigint not null auto_increment, username varchar(50) not null unique, email varchar(255) not null un ique, password_hint varchar(255), first_name varchar(50) not null, last_name varchar(50) n ot null, phone_number varchar(255), website varchar(255), account_expired bit not null, ac count_locked bit not null, credentials_expired bit not null, city varchar(50) not null, pr ovince varchar(100), postal_code varchar(15) not null, address varchar(150), country varch ar(100), account_enabled bit, version integer, password varchar(255) not null, primary key (id)) engine=innodb error [main] schemaexport.create(275) ¦ table 'app_user' already exists create table role (id bigint not null auto_increment, name varchar(20), description varcha r(64), primary key (id)) engine=innodb; error [main] schemaexport.create(274) ¦ unsuccessful: create table role (id bigint not nul l auto_increment, name varchar(20), description varchar(64), primary key (id)) engine=inno db error [main] schemaexport.create(275) ¦ table 'role' already exists create table user_role (user_id bigint not null, role_id bigint not null, primary key (use r_id, role_id)) engine=innodb; alter table user_role add index fk143bf46a7c4d7a42 (role_id), add constraint fk143bf46a7c4 d7a42 foreign key (role_id) references role (id); alter table user_role add index fk143bf46a21783e22 (user_id), add constraint fk143bf46a217 83e22 foreign key (user_id) references app_user (id); [warning] 6 errors occurred while performing <hbm2ddl> . [error] error #1: java.sql.sqlexception: error on rename of '.\appfuse2_test\user_role' to '.\appfuse2_test\#sql2-428-12' (errno: 152) [error] error #1: java.sql.sqlexception: error on rename of '.\appfuse2_test\user_role' to '.\appfuse2_test\#sql2-428-12' (errno: 152) [error] error #1: com.mysql.jdbc.exceptions.mysqlintegrityconstraintviolationexception: ca nnot delete or update a parent row: a foreign key constraint fails [error] error #1: com.mysql.jdbc.exceptions.mysqlintegrityconstraintviolationexception: ca nnot delete or update a parent row: a foreign key constraint fails [error] error #1: com.mysql.jdbc.exceptions.mysqlsyntaxerrorexception: table 'app_user' al ready exists [error] error #1: com.mysql.jdbc.exceptions.mysqlsyntaxerrorexception: table 'role' alread y exists [info] [compiler:testcompile] [info] compiling 31 source files to h:\appfuse2_test\target\test-classes [info] ------------------------------------------------------------------------ [error] build failure [info] ------------------------------------------------------------------------ [info] compilation failure h:\appfuse2_test\src\test\java\xwj\webapp\action\linkcategoryactiontest.java:[24,54] 需要 ')' h:\appfuse2_test\src\test\java\xwj\webapp\action\linkcategoryactiontest.java:[24,55] 需要 ';' h:\appfuse2_test\src\test\java\xwj\webapp\action\linkcategoryactiontest.java:[53,54] 需要 ')' h:\appfuse2_test\src\test\java\xwj\webapp\action\linkcategoryactiontest.java:[53,55] 需要 ';' [info] ------------------------------------------------------------------------ [info] for more information, run maven with the -e switch [info] ------------------------------------------------------------------------ [info] total time: 11 seconds [info] finished at: sat jan 19 10:58:35 gmt+08:00 2008 [info] final memory: 16m/29m [info] ------------------------------------------------------------------------ h:\appfuse2_test> | | |
|