• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Doubt on enthuware answer (II)

 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following question is from enthuware:

Identify the correct statements about the primary key of an entity:

a) It cannot consist of multiple fields.
b) It must be serializable and must also override equals and hashCode methods appropriately.
c) In an entity class hierarchy, the class for which the primary key has been defined must be the
root class of the hierarchy and must be an Entity class.
d) If property-based access is used, the properties of the primary key class must be public or protected.
e) The primary key class must be public or default accessed and must have a public no-arg constructor.


The correct answers are a) and d).

The explanation for b) being correct is: "The primary key class ..."

In my opinion b) isn't correct because the question asks for a "primary key" and not for a
primary key class or a composite primary key. So

@Id int id;

is a valid primary key and since id is of primitive type it hasn't even an equals or hashCode
method that could be overriden.
 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ralph,

Sorry if this sounds a little silly, but I am not sure I understand your question.

1) correct answers are a and d
2) you then say that b is also correct (but it wasn't in 1).
3) you then argue that b isn't correct (but it wasn't in 1).

Sorry!

MG
 
Ranch Hand
Posts: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh that was typo from Ralph.

I agree with Ralph...answer--

but all in given option's you have to select the answer which is the nearest.

if you don't this way, then definitely we are challenging the question...
 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

sorry for causing confusion. I meant "The correct answers given by enthuware are b) and d)".

Amandeep is right: There are indeed many such questions/answers in enthuware that are
not quite correct or at least discussable. It's best to choose the most likely answer and
hope for questions with unique answers in the real exam.
 
Enthuware Software Support
Posts: 4851
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are right. The question should specify primary key class instead of just primary key. It is has been fixed.

thanks!
 
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic