Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

Ranch Foreman
Posts: 1897
  • 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.
Who knew that furniture could be so violent? Put this tiny ad out there to see what happens:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic