Get Entity by ID - samerook/samerook_test GitHub Wiki

[Get Started](Get Started)

Method
javax.persistence.EntityManager

T find(
  Class entityClass,
  Object primaryKey
)

Find by primary key. Search for an entity of the specified class and primary key.
If the entity instance is contained in the persistence context, it is returned from there.

Employee employee = em.find(Employee.class, 1);
Employee managed = employee.getManager();

작동확인 코드

music = entityManager.find(Music.class, new Long(19));
System.out.println(music);
⚠️ **GitHub.com Fallback** ⚠️