I have a schema like this
Code:
A <- A_B -> B
|
A_B_OVERRIDE
A:
A_ID
PK
B:
B_ID
PK
DATE
A_B:
A_B_ID
PK
A_ID
FK
B_ID
FK
A_B_OVERRIDE:
A_B_ID
PK
DATE_OVERRIDE
A and B have a many-to-many relationship through association table A_B. The association table itself is exposed as an entity class, because there is a one-to-one hanging off of it that allows the owning entity of the relationship, A, to override an attribute of the owned entity B for the given relationship.
The override table itself as you can see is trivial, and is only used to avoid a nullable override column in A_B. Instead of mapping it as its own entity class, I use a <join> mapping to pull it into the class that maps A_B. This seems to work well and makes my code simple and easy to write.
What do you think?