Joined Strategy in Hibernate using Annotations

Joined Strategy in Hibernate using Annotations

In our previous example we have seen Single Table Strategy using Annotations. Here lets see the example of Joined Table in hibernate using Annotations

First let us understand the concept of Joined Strategy.

Joined Strategy

h1

 

Here we can see that for each class, Employee, Landline and Mobile separate tables are created and the data’s respective of those classes are saved. But the reference ID number is inserted in employee table. This is known as Joined Strategy

Lets see an example for this,

structure

employee.java

landline.java

mobile.java

NewHibernateUtil.java

hibernate.cfg.xml

execution.java

Output:
op1

Annotate_Employee
op2

Here we can see the names and reference ID’s are inserted into Annotate_Employee table.

mobile
op3

landline
op4

 

 

 

One thought on “Joined Strategy in Hibernate using Annotations

Leave a Reply

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