• 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 3, about untyped maps  RSS feed

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

Given that there is unidirectional oneToMany relationship between a Customer and Order, you want to model
it as a Map in Customer as following:
Order has a property named paymentType of enum PaymentType, with values such as CREDITCARD, DEBITCARD....

You want the paymentType field of Order entity to be the key of the map and the Order entity to be the value. The
primary key of Order is orderId, which is an integer.
Which of the following options correctly specify this relationship?
Choose two.

A. @OneToMany
  private Map<PaymentType, Order> orders;

  private Map orders;

C. @OneToMay
  private Map order;

Given answer A, B

I think the answer is only A.
B is not correct because it should be:
private Map orders;

Creator of Enthuware JWS+ V6
Posts: 3272
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree, B is not correct.

I think for B you also need a @MapKeyClass annotation (note that the @MapKeyClass and @MapKey annotations cannot be used together)
rubbery bacon. crispy tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!