JPA @ManyToOne no mappedBy attribute exist

Why doesn't the @ManyToOne JPA specification have a mappedBy attribute? @ManyToOne has both unidirectional and bidirectional relationships, but @OneToMany has only unidirectional relationships. Why is that?

Answers


Because the spec mandates that in a bidirectional OneToMany/ManyToOne association, the Many side must be the owner side (and thus doesn't need a mappedBy attribute), and the One side must be the inverse side (and thus needs a mappedBy attribute).


Need Your Help

cmd: How to extract part of a string?

batch-file cmd

in windows command line script I have string variable for an example: