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

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.416 :

Post by ETS User »

I thinkg the answer is not correct.

@AssociationOverride(
name="cubeLocation.building",
joinColumns=@JoinColumn(name="BLDG_ID")
)
private CubeLocation cubeLocation;

cubeLocation.building should be replaced with "building" only, since you don't need to use the name of the field when placing AssociationOverride besides the field which relationship you wish to override.

Take a look at persistence-2_0-final-spec.pdf, examples 1 and 2 inside chapter 11.1.4

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

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

Post by admin »

You are right, cubeLocation. is wrong here.

If cubeLocation were a field in a mapped super class of Employee, you would apply @AssociationOverride to the Employee class and the value of the name attribute would then be cubeLocation.building.

This has now been corrected. Thank you for your feedback!

cosminvacaroiu

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

Post by cosminvacaroiu »

also, why isn't C correct ? in my tests it works well

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

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

Post by admin »

As per section 11.1.2:
When used to override a mapping defined by a mapped superclass, the AssociationOverride
annotation is applied to the entity class.
...
When used to override a relationship mapping defined by an embeddable class (including an embeddable class embedded within another embeddable class), the AssociationOverride annotation
is applied to the field or property containing the embeddable.

Guest

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

Post by Guest »

admin wrote:As per section 11.1.2:
When used to override a mapping defined by a mapped superclass, the AssociationOverride
annotation is applied to the entity class.
...
When used to override a relationship mapping defined by an embeddable class (including an embeddable class embedded within another embeddable class), the AssociationOverride annotation
is applied to the field or property containing the embeddable.
In my tests it works, with implementation from Hibernate and EclipseLink.

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests