Win a copy of AWS Security this week in the Cloud/Virtualization 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 ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

question

 
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the following relationship between Customer and Address entities.
Customer 0..1 ----------- 0..* Address
What will be the result of the follow method call made by a client?
somecustomer.setAddresses(null);

Select 1 correct option.

1 In the Customer bean, the reference variable pointing to a Collection object for addresses will be set to null.

2 In the Customer bean, the Collection object referenced by variable for addresses will be emptied.

3 This call is illegal. It should pass an empty Collection object if it wants to remove all the addresses for a customer.

4 In the Customer bean, the Collection object referenced by variable for orders will be emptied and all the addresses entities will be deleted from the database.
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Parmeet,

Page 155 of the specification has the answer you are looking for:
"It is the responsibility of the Container to raise the java.lang.IllegalArgumentException if the Bean Provider attempts to assign null as the value of a collection-valued cmr-field by means of the set accessor method."

So option 3 is the correct one.

Regards,
Stefan
 
They worship nothing. They say it's because nothing is worth fighting for. Like this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic