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

Ranch Foreman
Posts: 1897
  • 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: 3341
Android Eclipse IDE Chrome
  • 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)
This looks like a job for .... legal tender! It says so right in this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic