Javatpoint Logo
Javatpoint Logo

Finding an entity

To find an entity, EntityManger interface provides find() method that searches an element on the basis of primary key.

JPA Entity Finding Example

Here, we will search a particular record and fetch it on the console.

This example contains the following steps: -

  • Create an entity class named as under com.javatpoint.jpa.student package that contains attributes s_id, s_name, s_age.

  • Now, map the entity class and other databases confiuguration in Persistence.xml file.


  • Create a persistence class named as under com.javatpoint.jpa.find package to persist the entity object with data.


JPA Finding an entity

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA