About Question enthuware.oce-jpad.v6.2.548 :

Moderator: admin

Post Reply
piotr.kraciuk
Posts: 9
Joined: Sat May 09, 2015 6:30 am
Contact:

About Question enthuware.oce-jpad.v6.2.548 :

Post by piotr.kraciuk »

This question would be more clear, if the Address class was presented. Right now it is not clear, whether it is Serializable or not, and whether it already has some annotations.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.548 :

Post by admin »

As a general rule, any information that is not present should be assumed to not affect the answer. In this case, both the things that you mentioned (Serializable and annotations) are being asked in the options. So you can safely assume that any information not already given is not relevant for the question.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

__JJ__
Posts: 125
Joined: Thu Jul 05, 2018 6:44 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.548 :

Post by __JJ__ »

I do not understand why annotating the Address class with @Entity is not a correct answer.
If I code this as it is, with an Address field but Address existing as just a class, neither annotated with @Entity or @Embeddable, it will presumably not work.
I can either annotate Address with @Entity, or with @Embeddable (and annotate the addr field with @Embedded).
So, why, and in what way, is the first way incorrect, because this is what I have been doing for weeks when coding my test programs.

By the way, the explanation given:
Address is not an entity in its own right. It is just a collection of fields of Employee class. Such type of classes are called embedded classes.
is curious because how are we supposed to know that from what is stated in the question? We simply have a field of type X. We are not told anything more than that. All we get is this:

Code: Select all

Address addr;
Where does it say in the question that Address is not an entity?

Thanks.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.548 :

Post by admin »

Technically, you can model Address as an entity but it is not a must. Option 2 says, "Address must be annotated with @Entity." That is certainly not true.

I think the decision to make Address a full fledged entity or not is a bit subjective. If you are developing an application that is about managing addresses, then probably you may make it an entity. Otherwise, an embeddable is fine.
If you like our products and services, please help us by posting your review here.

__JJ__
Posts: 125
Joined: Thu Jul 05, 2018 6:44 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.548 :

Post by __JJ__ »

OK I see, thank you.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 30 guests