permaculture playing cards*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Mock Exam about Entity Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Mock Exam about Entity Class" Watch "Mock Exam about Entity Class" New topic
Author

Mock Exam about Entity Class

Benoît de Chateauvieux
Ranch Hand

Joined: Aug 10, 2007
Posts: 183
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


SCJP5 | SCBCD5 | SCEA5 Part 1
Alex Kikhtenko
Greenhorn

Joined: Feb 09, 2008
Posts: 5
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

Joined: Aug 10, 2007
Posts: 183
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

Joined: Feb 09, 2008
Posts: 5
Oh, sorry. You're right.

It was my slip-up. Of course B is correct too. I misunderstood the clause "top level class".
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Mock Exam about Entity Class