Identical objects from has many

From ClassDBI

If you're taking a pre-existing database and adapting it to Class::DBI, you might run into a situation where attempting a fetch through a has_many defined method returns a bunch of identical objects.

This is because you have the foreign key as the main key for your class, and it isn't unique (not a proper primary key). The only solution I have found is to add another field (an autoincrementing field or a sequence), and make that the primary key. Now, all the fetches will run correctly. You can still make indices for other keys in order to speed up access, but the column CDBI is given as the primary key must be unique.

Another way to fix this problem is to tell your class that all columns together are the primary key (assuming this holds true).