Using DbUnit with tables which do not have primary keys
I'm attempting to set up my unit testing environment to use DbUnit.

I'm having a few problems as the tables which I am attempting to control do not have primary keys. I have been getting a `org.dbunit.dataset.NoPrimaryKeyException`.

I have followed the steps here [http://dbunit.wikidot.com/noprimarykeytable][1] but how do I use:

    connection.getConfig().setProperty("http://www.dbunit.org/properties/primaryKeyFilter", new MyPrimaryKeyFilter("A1"));

for each of my tables?

For example, I have the following database:

    CREATE TABLE `NO_PK1` (
      `A1` int(11) NOT NULL,
      `A2` varchar(50) default NULL
    );

    <?xml version="1.0" encoding="UTF-8"?>
    <dataset>
      <NO_PK1 A1="1" A2="Test1" />
      <NO_PK1 A1="2" A2="Test2" />
      <NO_PK1 A1="3" />
    </dataset>

    CREATE TABLE `NO_PK2` (
      `B1` int(11) NOT NULL,
      `B2` varchar(50) default NULL
    );

    <?xml version="1.0" encoding="UTF-8"?>
    <dataset>
      <NO_PK2 B1="1" B2="Test1" />
      <NO_PK2 B1="2" B2="Test2" />
      <NO_PK2 B1="3" />
    </dataset>

    CREATE TABLE `NO_PK3` (
      `C1` int(11) NOT NULL,
      `C2` varchar(50) default NULL
    );

    <?xml version="1.0" encoding="UTF-8"?>
    <dataset>
      <NO_PK3 C1="1" C2="Test1" />
      <NO_PK3 C1="2" C2="Test2" />
      <NO_PK3 C1="3" />
    </dataset>

How do I rewrite     `connection.getConfig().setProperty("http://www.dbunit.org/properties/primaryKeyFilter", new MyPrimaryKeyFilter("A1"));` in this instance?

Many thanks for any advice.

  [1]: http://dbunit.wikidot.com/noprimarykeytable
Using DbUnit with tables which do not have primary keys
===

I'm attempting to set up my unit testing environment to use DbUnit.

I'm having a few problems as the tables which I am attempting to control do not have primary keys. I have been getting a `org.dbunit.dataset.NoPrimaryKeyException`.

I have followed the steps here [http://dbunit.wikidot.com/noprimarykeytable][1] but how do I use:

    connection.getConfig().setProperty("http://www.dbunit.org/properties/primaryKeyFilter", new MyPrimaryKeyFilter("A1"));

for each of my tables?

For example, I have the following database:

    CREATE TABLE `NO_PK1` (
      `A1` int(11) NOT NULL,
      `A2` varchar(50) default NULL
    );

    <?xml version="1.0" encoding="UTF-8"?>
    <dataset>
      <NO_PK1 A1="1" A2="Test1" />
      <NO_PK1 A1="2" A2="Test2" />
      <NO_PK1 A1="3" />
    </dataset>

    CREATE TABLE `NO_PK2` (
      `B1` int(11) NOT NULL,
      `B2` varchar(50) default NULL
    );

    <?xml version="1.0" encoding="UTF-8"?>
    <dataset>
      <NO_PK2 B1="1" B2="Test1" />
      <NO_PK2 B1="2" B2="Test2" />
      <NO_PK2 B1="3" />
    </dataset>

    CREATE TABLE `NO_PK3` (
      `C1` int(11) NOT NULL,
      `C2` varchar(50) default NULL
    );

    <?xml version="1.0" encoding="UTF-8"?>
    <dataset>
      <NO_PK3 C1="1" C2="Test1" />
      <NO_PK3 C1="2" C2="Test2" />
      <NO_PK3 C1="3" />
    </dataset>

How do I rewrite     `connection.getConfig().setProperty("http://www.dbunit.org/properties/primaryKeyFilter", new MyPrimaryKeyFilter("A1"));` in this instance?

Many thanks for any advice.

  [1]: http://dbunit.wikidot.com/noprimarykeytable