This seems a little odd, if B's primary key is both 1B ad 2B, then how can the join table only have 1B? Is 1B unique, if so then why do you require 2B in the primary key?
In general EclipseLink does support using alternate keys in a m-m, but JPA does not. You can edit/define the ManyToManyMapping using a DescriptorCustomizer and the code API. Just add only the 1B field, however if 1B is not unique, I'm not sure how you intend this to function.