• 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

My exam cloud mock 4, primary key class

 
Bartender
Posts: 2037
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


The Java Persistence entity UserRole defines a composite primary key that is defined by the two columns userID and RoleID in the DB.
Which two are true?
Choose two.
A. UserRole must define a primary key class to represent the composite primary key.
B. The composite primary key is mapped as two fields in UserRole. No extra primary key class is necessary.
C. The combination of @Embedded and @Embeddable annotations can be used to denote the composite primary key.
D. The semantics of the equals and hashCode methods of the primary key class must be consist with the database equality.
Given answers :A,D.



I think the answers should be A,B,D.
For example, the two id's field should be mapped to the columns
 
Creator of Enthuware JWS+ V6
Posts: 3386
311
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
B is not correct because you need an extra primary key class (the one you are showing: @IdClass(Id.class))
 
Hoo hoo hoo! Looks like we got a live one! Here, wave this tiny ad at it:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic