About Question enthuware.oce-jpad.v6.2.564 :
Moderators: Site Manager, fjwalraven
About Question enthuware.oce-jpad.v6.2.564 :
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; }
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; }
Re: About Question enthuware.oce-jpad.v6.2.564 :
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.
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.
Re: About Question enthuware.oce-jpad.v6.2.564 :
One more clarification: @IdClass used only in combination with @Id
Re: About Question enthuware.oce-jpad.v6.2.564 :
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:
The question must be more specific if no mapping information is provided in XML.
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>
-
- Site Admin
- Posts: 10064
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.564 :
The question has been updated to make it clear that no mapping information is provided in XML.
thank you for your feedback!
thank you for your feedback!
If you like our products and services, please help us by posting your review here.
Re: About Question enthuware.oce-jpad.v6.2.564 :
OK, thanks!
PS I have passed the exam with score 96%
PS I have passed the exam with score 96%
Re: About Question enthuware.oce-jpad.v6.2.564 :
Wow ! Congratulations !!!
Your score even better than mine (I got 91%)
Your score even better than mine (I got 91%)
Who is online
Users browsing this forum: No registered users and 62 guests