Home » Enterprise Java » jpa » Page 2

jpa

Named query with entity in JPA

This is an example of how to create a named query with an entity in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications. A named query is a predefined query that you create and associate with a container-managed entity. The named queries are stored on the EntityManager. At ...

Read More »

Single table inheritance in JPA

In this example we shall show you how to create a single table inheritance in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications. Here we shall show you how to use inheritance in JPA.               Manager and ProjectManager classes The Manager class ...

Read More »

One To Many bidirectional mapping in JPA

With this example we are going to demonstrate how to use One to Many bidirectional mapping in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications. Here, we are using the JPA to define a one to many bidirectional mapping between two entities.             ...

Read More »

One To Many unidirectional mapping in JPA

This is an example of how to use One to Many unidirectional mapping in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications. Here, we are using the JPA to define a one to many unidirectional mapping between two entities.           Employee Class and Phone ...

Read More »

Many To One Mapping in JPA

In this example we shall show you how to create a many to one mapping in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications. Here, we are using the JPA to define a many to one mapping between two entities.             ManyToOneMappingInJPA class ...

Read More »

Delete with condition in JPA

With this example we are going to demonstrate how to delete with a condition in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications. Here, we are using JPA to delete an entity using a condition.               DeleteWithCondition class In DeleteWithCondition class we ...

Read More »

Remove Entity with JPA

This is an example of how to remove an entity using the JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications.                   Here, we are using JPA to remove an entity, as shown below: RemoveEntityWithJPA class In RemoveEntityWithJPA we create an ...

Read More »

Set column name and length

In this example we shall show you how to set the column name and length in an entity field in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications.                 Here, we are using JPA to set the column name and length ...

Read More »

Get single object in JPA

With this example we are going to demonstrate how to get a single object in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications.                   Here, we are using JPA to retrieve a single object from the database, as shown below: ...

Read More »

Find by class in JPA

This is an example of how to find an object by class in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications.                     Here, we are using JPA to retrieve an object by class, as shown below: The FindByClassInJPA class ...

Read More »