i have regenerate DDL and sql setting db2 as target.
In the local.properties under build dir i have set:
portal.database=db2
In the etc dir i create a new file named db2.properties:
hibernate.dialect=net.sf.hibernate.dialect.DB2Dialect
portal.datasource.driver=com.ibm.db2.jcc.DB2Driver
portal.datasource.url=jdbc:db2:lclabs
portal.datasource.username=user
portal.datasource.password=psw
now build all successful.
But:
the setup.ddl create is incorrect when use unique clause:
create table jbp_users (
jbp_uid INTEGER not null generated by default as identity,
jbp_root_pref_set_id INTEGER unique,
jbp_uname VARCHAR(255) unique,
jbp_givenname VARCHAR(255),
jbp_familyname VARCHAR(255),
jbp_password VARCHAR(255),
jbp_realemail VARCHAR(255),
jbp_fakeemail VARCHAR(255),
jbp_regdate TIMESTAMP,
jbp_viewrealemail SMALLINT,
jbp_enabled SMALLINT,
primary key (jbp_uid)
);
but this statement is not correct for db2: a unique attribute cannot be NULL
So i correct it using
create table jbp_users (
jbp_uid INTEGER not null generated by default as identity,
jbp_root_pref_set_id INTEGER not null unique,
jbp_uname VARCHAR(255) not null unique,
jbp_givenname VARCHAR(255),
jbp_familyname VARCHAR(255),
jbp_password VARCHAR(255),
jbp_realemail VARCHAR(255),
jbp_fakeemail VARCHAR(255),
jbp_regdate TIMESTAMP,
jbp_viewrealemail SMALLINT,
jbp_enabled SMALLINT,
primary key (jbp_uid)
);
this correction is done for all attribute table that use the unique clause.
Sql statements are not correct anyway:
This are the generated statements:
insert into jbp_users (jbp_uid, jbp_uname, jbp_password, jbp_realemail,
jbp_regdate, jbp_viewrealemail, jbp_enabled) values ('1', 'admin',
MD5('admin'), '[EMAIL PROTECTED]', NOW(), '1', '1');
insert into jbp_users (jbp_uid, jbp_uname, jbp_password, jbp_realemail,
jbp_regdate, jbp_viewrealemail, jbp_enabled) values ('2', 'user', MD5('user'),
'[EMAIL PROTECTED]', NOW(), '1', '1');
insert into jbp_roles (jbp_rid, jbp_name, jbp_displayname) values ('1',
'Admins', 'Administrators');
insert into jbp_roles (jbp_rid, jbp_name, jbp_displayname) values ('2',
'Users', 'Users');
insert into jbp_role_membership (jbp_uid, jbp_rid) values ('1', '1');
insert into jbp_role_membership (jbp_uid, jbp_rid) values ('2', '2');
but:
MD5 and NOW function are not supported by DB2
NOW() must be replaced by CURRENT_TIMESTAMP,
MD5... is not supported.
Numeric values must don't have '
All unique attribute must be set, so for example jbp_root_pref_set_id is now
not null and so the insert statement must set this column value, but for this
field there is a contraint, so what is correct?
remove the constraint, remove the unique clause, or what?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3870922#3870922
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3870922
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-Development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-development