Hibernate Outer Join

In this section, you will learn about types of outer joins in Hibernate.


 

Ads

Tutorials   
How to write hello world example program in Hibernate? How to create one to one relationship in Hibernate 4 with Annotation? How to calculate minimum in Hibernate using the min() Function Hibernate 4.3.4 Released: Hibernate 4.3.4.Final Maven dependency Hibernate 4.3 Hello World: Example How to create SessionFactory in Hibernate 4.3.1? Hibernate 4 Hello World: Example of Hello World program Hibernate 4 create Session Factory: Example of creating Session Factory in Hibernate 4 Hibernate 4.3 and JPA 2.1 Example What is Hibernate in Java? Hibernate Overview and Architecture What is JPA 2.1? Hibernate 4.3.0.Final Maven dependency Hibernate 4.3 ORM Features Hibernate 4.3 Tutorial Hibernate Criteria average example Hibernate Criteria load all objects from table Hibernate Criteria Hibernate beginner tutorial Hibernate Session.delete() Example Hibernate save or update method example Hibernate Load Example Hibernate save Example - Rose India Hibernate 4 tutorials Hibernate Example Step by Step in Eclipse Hibernate Configuration files Setup Hibernate Environment Hibernate Architecture Hibernate Overview Hibernate 4.2 Tutorial Hibernate 4 Annotations Tutorial Hibernate 4 AnnotationSessionFactoryBean hibernate versions hibernate jndi hibernate tomcat hibernate metamodel generator hibernate entity Seam Hibernate C3P0 Hibernate hibernate shard hibernate means temporal hibernate jsf hibernate spring j2ee hibernate spring hibernate encrypted password alias_to_entity_map hibernate temporal jsf spring hibernate hibernate by example hibernate repository hibernate sample code
Ads

Hibernate Outer Join

In this section, you will learn about types of outer joins in Hibernate.

What is Join in SQL?

A SQL join combines the matching records from the two database tables. The matching record is on the basis of some condition, which we will provide with the query. The simple SQL query is given below : (not for Hibernate)

SELECT Student.LastName, Student.FirstName, Enrollment.EnrollNo
FROM Student
INNER JOIN Enrollment
ON Student.EnrollNo=Enrollment.EnrollNo
ORDER BY Student.LastName

Join is of three types :

  • Inner Join
    Inner Join returns the matching row/rows between the two tables. In Hibernate, the keyword is inner join. The complete query is given below : 
    select e.firstname,e.lastname,e.cellphone,a.city,a.state,a.country from Employee e
    inner join e.address as a
  • Left Outer Join
    Left Outer Join returns all the records from the left table and only matching records from the right table. In Hibernate, the keyword is left join. The complete query is given below : 
    select e.firstname,e.lastname,e.cellphone,a.city,a.state,a.country from Employee e
    left join e.address as a

  • Right Outer Join
    The Right Outer Join returns all the records from right table and only matching records from the left table. In Hibernate, the keyword is right join. The complete query is given below :
    select e.firstname,e.lastname,e.cellphone,a.city,a.state,a.country from Employee e
    right join e.address as a
  • Full Join
    Full Join returns matching  records from both the table plus all the remaining records from both  the table. The full join is not usually useful.

For complete tutorial on the Outer Join please go through the below links :

Advertisements

Share on Google+Share on Google+

Hibernate Outer Join

Posted on: April 13, 2012 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: Hibernate Outer Join  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads