Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

My exam cloud , mock 2, entity manager's find method

Ranch Hand
Posts: 1742
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

public class Customer{
private int id;
Which of the following find an Order entity by its primary key?
A. EntityManager entityManager = //...
  Customer customer=(Customer) entityManager.find("Customer", new Integer(99));
B. EntityManager entityManager = //...
  Customer customer = (Customer) entityManager.findByPk("Customer", new Integer(99));
C. EntityManager entityManager= //...
  Customer customer= (Customer) entityManager.findByPrimaryKey("Customer", new Integer(99));
Given answer is A.

As I check the API, EntityManager's find method has the first argument Class<T>, not a string. I don't see any findByPrimaryKey method from EntityManager.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!