Home » Eclipse Projects » DTP » constraints for JDBCTable (was : datatools (cvs before 2 days), oracle , database explorer)
constraints for JDBCTable (was : datatools (cvs before 2 days), oracle , database explorer) [message #3127] |
Fri, 21 October 2005 05:19 |
Haris Peco Messages: 1072 Registered: July 2009 |
Senior Member |
|
|
Hi,
i describe problem with constraints in my previous post (i hope clearly)
This is correct method JDBCTable#loadForeignKey (I comment changed lines and
there is one added line with comment 'added'
I try with (with big and complicated Oracle schema) and it work fine
Please apply
private synchronized void loadForeignKey(DatabaseMetaData metaData,
UniqueConstraint uk){
try {
ResultSet r = metaData.getImportedKeys(null,
this.getSchema().getName(),this.getName());
//ResultSet r = metaData.getExportedKeys(null,
this.getSchema().getName(),this.getName());
//DataModelElementFactory factory =
RDBCorePlugin.getDefault().getDatabaseDefinitionRegistry().g etDefinition(this.getCatalogDatabase()).getDataModelElementF actory();
JDBCForeignKey fk = null;
Table fkTable=null;
String fkTableName=""; //$NON-NLS-1$
while(r.next()) {
//final String fkSchema_Name= r.getString(6);
final String fkSchema_Name= r.getString(2);
//final String fkTable_Name = r.getString(7);
final String fkTable_Name = r.getString(3);
if(!fkTableName.equals(fkTable_Name)) {
fkTable= this.getTable(fkSchema_Name,fkTable_Name);
if (fkTable==null) continue;
fkTableName = fkTable_Name;
fk = new JDBCForeignKey();
final String fkName = r.getString(12);
fk.setName(fkName);
UniqueConstraint pk = ((BaseTable) fkTable).getPrimaryKey(); // added
//fk.setUniqueConstraint(uk);
fk.setUniqueConstraint(pk);
short updateRule = r.getShort(10);
switch(updateRule) {
case DatabaseMetaData.importedKeyCascade:
fk.setOnUpdate(ReferentialActionType.CASCADE_LITERAL);
break;
case DatabaseMetaData.importedKeyRestrict:
fk.setOnUpdate(ReferentialActionType.RESTRICT_LITERAL);
break;
case DatabaseMetaData.importedKeySetDefault:
fk.setOnUpdate(ReferentialActionType.SET_DEFAULT_LITERAL);
break;
case DatabaseMetaData.importedKeySetNull:
fk.setOnUpdate(ReferentialActionType.SET_NULL_LITERAL);
break;
case DatabaseMetaData.importedKeyNoAction:
default:
fk.setOnUpdate(ReferentialActionType.NO_ACTION_LITERAL);
break;
}
short deleteRule = r.getShort(11);
switch(deleteRule) {
case DatabaseMetaData.importedKeyCascade:
fk.setOnDelete(ReferentialActionType.CASCADE_LITERAL);
break;
case DatabaseMetaData.importedKeyRestrict:
fk.setOnDelete(ReferentialActionType.RESTRICT_LITERAL);
break;
case DatabaseMetaData.importedKeySetDefault:
fk.setOnDelete(ReferentialActionType.SET_DEFAULT_LITERAL);
break;
case DatabaseMetaData.importedKeySetNull:
fk.setOnDelete(ReferentialActionType.SET_NULL_LITERAL);
break;
case DatabaseMetaData.importedKeyNoAction:
default:
fk.setOnDelete(ReferentialActionType.NO_ACTION_LITERAL);
break;
}
short deferrability = r.getShort(14);
switch(deferrability) {
case DatabaseMetaData.importedKeyInitiallyDeferred:
fk.setDeferrable(true);
fk.setInitiallyDeferred(true);
break;
case DatabaseMetaData.importedKeyInitiallyImmediate:
fk.setDeferrable(true);
fk.setInitiallyDeferred(false);
break;
case DatabaseMetaData.importedKeyNotDeferrable:
default:
fk.setDeferrable(false);
break;
}
// ((BaseTable)fkTable).getConstraints().add(fk);
constraints.add(fk);
}
//String columnName = r.getString(8);
String columnName = r.getString(4);
Column column = JDBCTable.getColumn(fkTable,columnName);
//Column column = JDBCTable.getColumn(this,columnName);
fk.getMembers().add(column);
/* Add EAnnotation */
EList tmpList = fk.getMembers();
boolean isIdentify = fk.isIdentifyingRelationship(tmpList);
EAnnotation eAnnotation =
fk.addEAnnotation(RDBCorePlugin.FK_MODELING_RELATIONSHIP);
fk.addEAnnotationDetail(eAnnotation,RDBCorePlugin.FK_IS_IDEN TIFYING_RELATIONSHIP,new
Boolean(isIdentify).toString());
fk.addEAnnotationDetail(eAnnotation,
RDBCorePlugin.FK_CHILD_MULTIPLICITY, RDBCorePlugin.MANY);
fk.addEAnnotationDetail(eAnnotation, RDBCorePlugin.FK_CHILD_ROLE_NAME,
new String ());
fk.addEAnnotationDetail(eAnnotation,
RDBCorePlugin.FK_PARENT_MULTIPLICITY, (fk.getMembers().size() > 0) ?
RDBCorePlugin.ZERO_TO_ONE : RDBCorePlugin.ONE);
fk.addEAnnotationDetail(eAnnotation, RDBCorePlugin.FK_PARENT_ROLE_NAME,
new String ());
}
r.close();
}catch (Exception e){
e.printStackTrace();
}
}
|
|
|
Re: constraints for JDBCTable (was : datatools (cvs before 2 days), oracle , database explorer) [message #3194 is a reply to message #3127] |
Fri, 21 October 2005 14:06 |
Eclipse User |
|
|
|
Originally posted by: jograham.sybase.com
Harris,
Currently DTP is building toward its first set of milestones and then
release. We are in the process of consolidating four contributed code
lines (WTP, BIRT, Sybase, objectNation), and so there is a lot of code in
CVS that is either incomplete, not working, or simply in the process of
being refactored to consolidation. The purpose of the iteration builds is
to help the community identify those subsets that some reasonable level of
completion, and we intend to increase these subsets to include all planned
components over time.
The problems you're seeing are with code ported from WTP/rdb for
consolidation purposes. Eventually these specific plug-ins will not exist
as-is, though we will certainly keep an eye on the types of issues you are
experiencing as we replicate functionality in the new DTP components.
So, I'd say there are two choices for you at the moment (1) If you need
this functionality now and are using WTP/rdb, then I would address the
issue to that newsgroup or (2) Wait until DTP is complete in these areas
[approx late 6Q1] and then we would be in a position to support bug
reports/questions on the released components.
Regards,
John Graham
Eclipse Data Tools Platform PMC
|
|
| |
Re: constraints for JDBCTable (was : datatools (cvs before 2 days), oracle , database explorer) [message #567218 is a reply to message #3127] |
Fri, 21 October 2005 14:06 |
John Graham Messages: 183 Registered: July 2009 |
Senior Member |
|
|
Harris,
Currently DTP is building toward its first set of milestones and then
release. We are in the process of consolidating four contributed code
lines (WTP, BIRT, Sybase, objectNation), and so there is a lot of code in
CVS that is either incomplete, not working, or simply in the process of
being refactored to consolidation. The purpose of the iteration builds is
to help the community identify those subsets that some reasonable level of
completion, and we intend to increase these subsets to include all planned
components over time.
The problems you're seeing are with code ported from WTP/rdb for
consolidation purposes. Eventually these specific plug-ins will not exist
as-is, though we will certainly keep an eye on the types of issues you are
experiencing as we replicate functionality in the new DTP components.
So, I'd say there are two choices for you at the moment (1) If you need
this functionality now and are using WTP/rdb, then I would address the
issue to that newsgroup or (2) Wait until DTP is complete in these areas
[approx late 6Q1] and then we would be in a position to support bug
reports/questions on the released components.
Regards,
John Graham
Eclipse Data Tools Platform PMC
|
|
| |
Goto Forum:
Current Time: Wed Sep 25 19:14:07 GMT 2024
Powered by FUDForum. Page generated in 0.04057 seconds
|