Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dd934b0

Browse files
+ 28th HB
1 parent ccf4bb3 commit dd934b0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎README.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,16 @@
236236
- `@JoinColumn`
237237
- `@JoinColumn`
238238

239+
28. __`MappedBy` & `@JoinColumn` usage__<br>
240+
JPA Relationships can be either unidirectional or bidirectional. It simply means we can model them as an attribute on exactly one of the associated entities or both.
239241

242+
Defining the direction of the relationship between entities has no impact on the database mapping. It only defines the directions in which we use that relationship in our domain model.
243+
244+
For a bidirectional relationship, we usually define:
245+
- the owning side
246+
- inverse or the referencing side
247+
248+
The `@JoinColumn` annotation helps us specify the column we’ll use for joining an entity association or element collection. On the other hand, the `mappedBy` attribute is used to define the referencing side (non-owning side) of the relationship.
240249

241250

242251

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /