DDC-289: Owning Side OneToMany through Join-Table fails with MappingException #357

Closed
opened 2026-01-22 12:35:57 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Jan 31, 2010).

Jira issue originally created by user @beberlei:

Currently OneToMany through Join-Table can only be implemented using the @ManyToMany element as the @OneToMany fails with a MappingException requiring a "mappedBy".

Originally created by @doctrinebot on GitHub (Jan 31, 2010). Jira issue originally created by user @beberlei: Currently OneToMany through Join-Table can only be implemented using the @ManyToMany element as the @OneToMany fails with a MappingException requiring a "mappedBy".
admin added the Bug label 2026-01-22 12:35:57 +01:00
admin closed this issue 2026-01-22 12:35:57 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jan 31, 2010):

Comment created by @beberlei:

Is this expected behaviour to use the @ManyToMany for this? It seems there is too much special code needed to let the @OneToMany support this also.

@doctrinebot commented on GitHub (Jan 31, 2010): Comment created by @beberlei: Is this expected behaviour to use the @ManyToMany for this? It seems there is too much special code needed to let the @OneToMany support this also.
Author
Owner

@doctrinebot commented on GitHub (Jan 31, 2010):

Comment created by romanb:

Yes, it is expected behavior to map this as many-to-many.

You simply map it as a uni-directional many-to-many and put a unique constraint on 1 join column of the join table and voila, you have effectively a uni-directional one-to-many from point of view of your classes.

@doctrinebot commented on GitHub (Jan 31, 2010): Comment created by romanb: Yes, it is expected behavior to map this as many-to-many. You simply map it as a uni-directional many-to-many and put a unique constraint on 1 join column of the join table and voila, you have effectively a uni-directional one-to-many from point of view of your classes.
Author
Owner

@doctrinebot commented on GitHub (Jan 31, 2010):

Comment created by @beberlei:

Added little note to documentation and closed.

@doctrinebot commented on GitHub (Jan 31, 2010): Comment created by @beberlei: Added little note to documentation and closed.
Author
Owner

@doctrinebot commented on GitHub (Jan 31, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Jan 31, 2010): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#357