Posted: February 7, 2012 in Random Posts

Nikos' Java blog

The Java Persistence API is the standard framework for persistence in both Java SE and Java EE platforms. It is the outcome of the collaborative work of the industry’s leading vendors in object-relational mapping, EJB and JDO, including a remarkable contribution from the open source community.

In this post we summarize, one-by-one, the essential relationships between entities. We examine each relationship from the prespectives of “Domain Model” and “Relation Model”, and provide the associated construction in JPA. Finally, for each relationship we present an example from the real world.

The relationships are divided in two categories. “For daily use” presents the correct way to use common relationships in our application development activities. On the other hand, “Containing pitfalls” identify common mistakes.

For daily use:

  1. One-to-One (one direction)
  2. One-to-One (both directions)
  3. Many-to-One (one direction)
  4. Many-to-One (both directions)
  5. One-to-Many (one direction)
  6. One-to-Many (both directions)
  7. Many-to-Many (both directions)

Containing pitfalls:

  1. Many-to-Many (one direction)

View original post 1,025 more words


Leave a Reply

Please log in using one of these methods to post your comment: Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s