From: <EP...@up...> - 2003-01-28 14:55:30
|
I will try and get to it this evening to test. However, building from source is VERY easy, and if you want to get the newest fixes, it is the best way to go. If you have difficulties, please mail the list so we can figure out where people have difficulities. Eric Pugh -----Original Message----- From: Gaetano Di Gregorio [mailto:gae...@s1...] Sent: Tuesday, January 28, 2003 5:32 AM To: dbu...@li... Subject: RE: [dbunit-user] InsertIdentityOperation doesn't support identity columns that are not primary keys I think that to fix the issue, you should replace the following existing code of InsertIdentityOperation.hasIdentityColumn in the org.dbunit.operation.mssqlserver package : private boolean hasIdentityColumn(ITableMetaData metaData) throws DataSetException { Column[] primaryKeys = metaData.getPrimaryKeys(); for (int i = 0; i < primaryKeys.length; i++) { if (primaryKeys[i].getSqlTypeName().endsWith("identity")) { return true; } } return false; } by this new code private boolean hasIdentityColumn(ITableMetaData metaData) throws DataSetException { Column[] tableColumns = metaData.getColumns(); // we check all columns instead of primary keys only for (int i = 0; i < tableColumns.length; i++) { if (tableColumns[i].getSqlTypeName().endsWith("identity")) { return true; } } return false; } I'm not able to test it myself has I've no time to configure my project for bulding dbunit jar from the source provided ... Hope this help. -----Original Message----- From: dbu...@li... [mailto:dbu...@li...] On Behalf Of EP...@up... Sent: samedi 25 janvier 2003 0:59 To: dbu...@li... Subject: RE: [dbunit-user] InsertIdentityOperation doesn't support identity columns that are not primary keys Great! I can't wait to see your patches. Eric Pugh -----Original Message----- From: Gaetano Di Gregorio [mailto:gae...@s1...] Sent: Thursday, January 23, 2003 10:54 AM To: dbu...@li... Subject: RE: [dbunit-user] InsertIdentityOperation doesn't support identity columns that are not primary keys I'll try to do my best to fix it next week (I'm too busy this week). I think I'll be able to send the fixed source code for the hasIdentityColumn method and hope somebody from the dev team will be able to integrate it in CVS, etc. -----Original Message----- From: dbu...@li... [mailto:dbu...@li...] On Behalf Of EP...@up... Sent: jeudi 23 janvier 2003 16:11 To: dbu...@li... Subject: RE: [dbunit-user] InsertIdentityOperation doesn't support identity columns that are not primary keys Gaetano... Thanks for the message. If you feel like submitting a patch and a test case great, other wise I'll add it to my list of DbUnit things to check into. I guess all my databases have always had identity columns that where primary keys! Eric -----Original Message----- From: Gaetano Di Gregorio [mailto:gae...@s1...] Sent: Thursday, January 23, 2003 9:34 AM To: dbu...@li... Subject: [dbunit-user] InsertIdentityOperation doesn't support identity columns that are not primary keys Hi, I think there is a bug in the InsertIdentityOperation.hasIdentityColumn method. Indeed, it only returns true if a identity column is also a primary key. But SQL Server 2000 allows you to create an identity column that is not marked has a primary key (we have such a column in our database). I think the hasIdentityColumn should be rewritten to check identity attribute on all columns and not only on the one that are primary keys. Regards, Gaetano Di Gregorio. |