The lab and assignment tables are both declared as the owner of a many to many relationship. This caused two join tables to be created one for both entities. Neither of the two tables contained the other, so this migration inserts their union into a third new table.
The composite key needs to be done through jpa compliant annotations for spring repositories to work correctly. Note that this differs from the hibernate documentation.
Spring repositories apparently code to the jpa spec not to the hibernate implementation. The way to create a composite key using JPA is to create an embeddable that you use as an @EmbeddedId. The associations then need a corresponding @MapsId to link it to the id stored in the embedded id.
There is still a lot of work to do before this lab <-> assignment dataflow is anywhere near sane. There's lots of bullshit happening with cloning of labs, updating labs through shallow clones of json and copying things over from assignments and courses.
Steps to take:
Geez man this shit was fucked up....