• 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Mock Exam about Entity Class  RSS feed

 
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
 
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
Boost this thread!