Bugs item #512760, was opened at 2002-02-04 06:08
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=512760&group_id=22866
Category: JBossCMP
Group: v3.0 Rabbit Hole
Status: Open
Resolution: None
Priority: 5
Submitted By: Matt (mpetteys)
Assigned to: Nobody/Anonymous (nobody)
Summary: Patch: Add NOT NULL for pk in createSQL
Initial Comment:
When tables with are created with primary keys in CMP,
currently no column modifiers are used to create the
table. The following is sql that is used to
create "table1" which has a primary key of "id"..
CREATE TABLE table1 (id VARCHAR(255) BINARY, data2
BLOB, data2 BLOB, CONSTRAINT pk_table1 PRIMARY KEY
(id))
The current version of MySQL blows up on this because
the column "id" should not be null because it is
primary key column. The attached patch checks the
columns to see if they are a primary key column and
adds the "not null" modifier if they are.
CREATE TABLE table1 (id VARCHAR(255) BINARY NOT NULL,
data2 BLOB, data2 BLOB, CONSTRAINT pk_table1 PRIMARY
KEY (id))
I believe most db supports "not null" so this should
work universally without having to worry about DB
specific syntax and I don't think that EJBs allow null
primary keys so that shouldn't be a problem.
----------------------------------------------------------------------
Comment By: Andrew Marki (apmliq)
Date: 2002-02-05 12:20
Message:
Logged In: YES
user_id=240275
To handle pk constraints on relation tables, I added a flag
so JDBCStartCommand.getRelationCreateTableSQL() can force
not null on all fields in
SQLUtil.getCreateTableColumnsClause(fields, all) { ... if
(all || field.isPrimaryKeyMember()) ...}
In getRelationCreateTableSQL(),
boolean hasPKC = cmrField.getRelationMetadata
().hasPrimaryKeyConstraint();
and invoke
SQLUtil.getCTCC(fields, hasPKC);
getCTCC(fields) just calls getCTCC(fields, false);
The equivalent of <nullable> would be nice.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=512760&group_id=22866
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development