Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock Exam about Entity Class

 
Benoît de Chateauvieux
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

In the JavaBeat'site, I found a Mock Exam on JPA.
I'm confused with the first question:

1)Which of the following statements are true about the Entity class?

a)Entity class must not have no-arg constructor
b)Entity class must be declared as top level class
c)Interface cannot be Entity
d)Enum can be declared as Entity.

The answer is b and d.
But I think the good answers ar b and c because I found in the spec (2.1) "An enum or interface should not be designated as an entity."

What's your opinion ?
Thanks in advance,

Beno�t
 
Alex Kikhtenko
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As for me, the inly possible answer here is C.
All other answers violate rules described by JPA specification.
Answer B is also not correct because Entity may be disposed anywhere in a certain class hierarchy.
 
Benoît de Chateauvieux
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alex,

Thanks for your answer.
I think that "b)Entity class must be declared as top level class" means that an entity can't be a inner-class.
So, for me, B is right too.
 
Alex Kikhtenko
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, sorry. You're right.

It was my slip-up. Of course B is correct too. I misunderstood the clause "top level class".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic