A common workaround is to add an auto_increment key to the many-to-many resolver table, and rather than have defining relationships, just make standard foreign key relationships to the tables. As long as you have an index on the two columns performance will be fine.