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

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
ETS User

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

Post by ETS User »

Hi,

I think the last choice is also correct, can anyone explain why it is wrong?

private Integer acctid;
private Double balance;

public Integer getAcctid() { return this.acctid; }
public void setAcctid(Integer acctid) { this.acctid = acctid; }

public Double getBalance() { return this.balance; }
public void setBalance(Double balance) { this.balance = balance; }

M_Z

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

Post by M_Z »

Because there are 2 mandatory annotations for ANY entity:

1) @Entity annotation on class (it's assumed in question, just does not shown)
2) Primary key annotation - most often @Id is used, however any of these are possible: @Id, @IdClass, @EmbeddedId

Since the mentioned option does not have PK annotation, it's invalid -- JPA provider does not know how to handle the entity.

M_Z

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

Post by M_Z »

One more clarification: @IdClass used only in combination with @Id

peter

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

Post by peter »

It's clear

M_Z

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

Post by M_Z »

After a second thought, I think you're right - option D also can be selected as correct.

We can define Promary Key information in deployment descriptor (like orm.xml)

Persistence provider uses combination (union) of annotations and XML mappings for it's work (XML has precedence).

So, I think it's a valid situation (although I would say crazy) when developer defines @Entity via annotation, and ID defined like this in orm.xml:

Code: Select all

<entity class="Account">
	<attributes>
		<id name="acctid" />
	</attributes>
</entity>
The question must be more specific if no mapping information is provided in XML.

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

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

Post by admin »

The question has been updated to make it clear that no mapping information is provided in XML.

thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Peter

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

Post by Peter »

OK, thanks!

PS I have passed the exam with score 96%

M_Z

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

Post by M_Z »

Wow ! Congratulations !!! ;)

Your score even better than mine (I got 91%)

Post Reply

Who is online

Users browsing this forum: No registered users and 62 guests