Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • 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
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

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

Ranch Hand
Posts: 1732
  • 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!