Hibernate : use of mappedBy

Relationship is something in which two objects are related in some way. Now in object orientation it not necessary that both the side must show same relationship status,

For example :

I love her (1 to 1)
however she might love others (1 to many)

Now when we want to delegate the responsibility of maintaining the relationship on other side that time we can use mappedBy, In this way we might not require join table as well. In this case a separate join table can also be avoided.

image

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s