I have a many to many relation which requires additional attribute to be persisted in the join table, for example Order and Product relation with quantity attribute.
to use JPA, that join table should be implemented as entity, and the relation is broken into many to one and one to many, I saw in many threads that I have to reserve the given domain relations without a change, I heard that many people lost points because of changes in the given domain model.
Should I reserve the given model as is (how to persist quantity in this case?), or can I change the given mode without a problem?
SCJP, SCWCD, SCEA 1/3
Thanks Jeanne for your reply; I'm changing in the shape of existing relation in the domain model which was direct many to many but I injected the joined table in between (it's still many to many but the diagram is changed), after seeing some threads I think I'll remove it as loosing some points for not handling quantity attribute is better than loosing them all for changing in their holy domain model.
what do you think about the desing problem itself, am I right and the built in manytomany anotation in JPA can't handle this alone?
ahmed fayed wrote:I've found another way to keep the direct relation between the two domain entities by using a Map ElementCollection feature of JPA 2.0; I've tested it on the quantity attribute and found it working.
I think class diagram should be technology agnostic, it's no need to specify what technologies you are using here, just remaining the relationship many to many should be better.