When i am trying to import a db where there is no primary key mapped i am facing the issue.
The solution is to use IColumnFilter and add this in config but this is failling in our scneario.
We have 700 tables and in which only 2 tables are not having id.
Also there is no condition of primary key nomenclature and people have added it in different ways.
If i am implimenting IColumnFilter then i have to specify the id for all the tables which is not acceptable and your implimentation. Without filter the keyis fetched from getPrimaryKeyNames() of DatabaseTableMetaData.
The proposed solution is changing the DatabaseTableMetaData.java with this implimentation in getPrimaryKeys
if (primaryKeysFilter != null) {
_primaryKeys = Columns.getColumns(getTableName(), getColumns(),
primaryKeysFilter);
if (null !=_primaryKeys &&_primaryKeys.length<=0) {
String[] pkNames = getPrimaryKeyNames();
_primaryKeys = Columns.getColumns(pkNames, getColumns());
}
} else {
String[] pkNames = getPrimaryKeyNames();
_primaryKeys = Columns.getColumns(pkNames, getColumns());
}
Hi Puneet,
Thanks for finding a solution and reporting the problem.
To have it applied to dbUnit code, please create one or more tests proving the problem exists and the change fixes it. Then make a merge request for them or attach a patch to this issue.
We can then review and apply it when it is ready.
Let us know if you need any help.
Hi Jeff,
Merge request with code change and DBunit has been pushed to trunk. Kindly check once.
https://sourceforge.net/p/dbunit/code.git/merge-requests/38/
Hi Puneet, I posted MR feedback today and also posting here in case you don't receive MR update notifications.
Made the changes. Kindly look into https://sourceforge.net/p/dbunit/code.git/merge-requests/39/
Hi Puneet, just following up - did you see the issues we wrote many months ago on the merge request? If you are still interested in this improvement, please see the MR.