This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Entities association relationship defaults - Choose Correct statement

 
Amar Gadewar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following is from a mock test on Whizlabs. Questions 32.

Choose 2 correct statements about the association relationship defaults that applies to persistence entities:

a. It is not necessary that the relationship mapping defaults that applies to entities using annotation modeling will be same as if defined using deployment descriptor.

b. A unidirectional relationship can have only owning side.

c. A unidirectional relationship can have only reference side.

d. mappedBy element is used to refer the owning side in case of bi directional relationships


The correct answers given are B and D.

I am clear about A been incorrect, that the defaults should be same for association relationship, regardless of using Annotations or Deployment Descriptor.
So A is incorrect.

I am also clear about B been the correct, as in Unidirectional Relationship, there is only one Owning side which has the reference to the other entity.

Here i am assuming the that the existing of foreign key has not relation with regards to Ownership.

C is incorrect as B is Correct.


D is incorrect it is the inverse side. Now as per me there is only one correct statement above. Please comment if otherwise.

 
Raf Szczypiorski
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think D should say:
"mappedBy element is used to refer to the owning side in case of bi directional relationships"
or even
"mappedBy element is used by the inverse side to refer to the owning side in case of bi directional relationships"
 
Amar Gadewar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Raf, Makes sense now with the changed wording. Maybe just a typo while preparing the question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic