JPA Joins

The following two tabs change content below.
Prasad Kharkar is a java enthusiast and always keen to explore and learn java technologies. He is SCJP,OCPWCD, OCEJPAD and aspires to be java architect.

Latest posts by Prasad Kharkar (see all)

As of now we have seen about simple queries in JPA. This article will deal with introduction to JPA joins.

JPA Joins

JPA joins queries are used to retrieve data from more that on entities. When join queries are translated to SQL, then it is likely that joins between entities will produce similar joins between the tables represented by entities.

Joins can occur whenever any of the following conditions are met.

  • Two or more range variable declarations are listed in FROM clause and appear in SELECT clause.
  • The JOIN operator is used to extend an identification variable using a path expression.
  • A path expression anywhere in the query navigates across an association field, to the same or a different entity.
  • One or more where conditions compare attributes of different identification variables.

The semantics of jpa joins between entities are the same as SQL joins between tables.

JPA Joins are are categorized into

  • Inner joins
  • Outer joins

In further articles, we will learn about inner and outer jpa joins.

 

References for further study :

 

Share Button

Prasad Kharkar

Prasad Kharkar is a java enthusiast and always keen to explore and learn java technologies. He is SCJP,OCPWCD, OCEJPAD and aspires to be java architect.

Leave a Reply

Your email address will not be published. Required fields are marked *