Posted in JPA

One to One Mapping in JPA

In this example I am going to show you how we can implement One to One(@OneToOne) relationship using JPA persistence API in Java. The Java Persistence API (JPA) is a Java specification for accessing, persisting, and managing data between Java objects / classes and a relational database. The JPA is used to reduce the burden of writing codes for relational…

Continue Reading... One to One Mapping in JPA
Posted in Hibernate

Bidirectional One-To-One Relationship with Join Tables in Hibernate

In bidirectional association, we will have navigation in both direction, i.e, both side of the association will have the reference to the other side. The both side of the association will implement one of the collection interfaces, if it has the reference to the other entity. In one to one relationship, one source object can have relationship with only one…

Continue Reading... Bidirectional One-To-One Relationship with Join Tables in Hibernate
Posted in Hibernate

Unidirectional One-To-One Relationship with Join Tables in Hibernate

In unidirectional association, we will have navigation only in one direction, i.e, only one side of the association will have the reference to the other side. The one side of the association will implement one of the collection interfaces, if it has the reference to the other entity. In one to one relationship, single target object can have relationship with…

Continue Reading... Unidirectional One-To-One Relationship with Join Tables in Hibernate
Posted in Hibernate

Bidirectional One-To-One Relationship on Primary Key in Hibernate

In bidirectional association, we will have navigation in both direction, i.e, both side of the association will have the reference to the other side. The both side of the association will implement one of the collection interfaces, if it has the reference to the other entity. In one to one relationship, one source object can have relationship with only one…

Continue Reading... Bidirectional One-To-One Relationship on Primary Key in Hibernate
Posted in Hibernate

Bidirectional One-To-One Relationship on Foreign Key in Hibernate

In bidirectional association, we will have navigation in both directions, i.e, both side of the association will have the reference to the other side. The both side of the association will implement one of the collection interfaces, if it has the reference to the other entity. In one to one relationship, one source object can have relationship with only one…

Continue Reading... Bidirectional One-To-One Relationship on Foreign Key in Hibernate
Posted in Hibernate

Unidirectional One-To-One Relationship on Primary Key in Hibernate

In unidirectional association, we will have navigation only in one direction, i.e, only one side of the association will have the reference to the other side. In one to one relationship, one source object can have relationship with only one target object. Let’s consider CD and Artist. So one CD can be written by one Artist or an Artist can…

Continue Reading... Unidirectional One-To-One Relationship on Primary Key in Hibernate
Posted in Hibernate

Unidirectional One-To-One Relashionship on Foreign Key in Hibernate

In unidirectional association, we will have navigation only in one direction, i.e, only one side of the association will have the reference to the other side. In one to one relationship, one source object can have relationship with only one target object. Let’s consider CD and Artist. So one CD can be written by one Artist or only one Artist…

Continue Reading... Unidirectional One-To-One Relashionship on Foreign Key in Hibernate