Home » jpa » Page 3

Tag Archives: jpa

Map Java Enum type in JPA

In this example we shall show you how to map a Java Enum type in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications. Here, we map a Java Enum implementation in JPA, as described below: An entity class An entity is a lightweight persistence domain object. Typically, an ...

Read More »

Embedded compound primary key in JPA

With this example we are going to demonstrate how to create an embedded compound primary key in JPA. The Java Persistence API provides Java developers with an object/relational mapping facility for managing relational data in Java applications. A composite primary key is usually made up of two or more primitive or JDK object types. Composite primary keys typically arise when ...

Read More »

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 »