New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid data that could lead to ambiguous column label usage #843
Conversation
See jakartaee/persistence#350 for further discussion
I see nothing wrong with the change myself. We would like to merge this change soon if the test truly needs it but first please could I get some help with understanding if this change is needed even though SqlResultSetMappings is specified? See more details below... Should the the @SqlResultSetMappings in Order1 have avoided the need for this change? Or is SqlResultSetMappings (click here for spec text) for something else? Note that SqlResultSetMappings is also mentioned in section 3.10.16.1. Returning Managed Entities from Native Queries which was discussed in the issue but I didn't see |
Changing the data will uncover that the test is "wrong", but for further information on that, see jakartaee/persistence#350. I tested this on EclipseLink and it will produce "wrong" results. The problem is that the test goes against the wording in 3.10.16.1, because the result label @SqlResultSetMapping(name = "Order1ItemResults", entities = {
@EntityResult(entityClass = com.sun.ts.tests.jpa.core.annotations.nativequery.Order1.class, fields = {
@FieldResult(name = "id", column = "OID"),
@FieldResult(name = "totalPrice", column = "OPRICE"),
@FieldResult(name = "item", column = "OITEM") }) }),
@EntityResult(entityClass = com.sun.ts.tests.jpa.core.annotations.nativequery.Item.class) }), q = getEntityManager().createNativeQuery(
"Select o.\"ID\" OID, o.\"TOTALPRICE\" OPRICE, "
+ " o.\"FK1_FOR_ITEM\" OITEM, i.\"ID\", i.\"ITEMNAME\" from \"ORDER1\" o, \"ITEM\" i "
+ "WHERE (o.\"TOTALPRICE\" > 140) AND (o.\"FK1_FOR_ITEM\" = i.\"ID\")",
"Order1ItemResults").getResultList(); In fact, |
Thanks for explaining, the example makes sense!
To explore that, the PERSISTENCE:SPEC:736
PERSISTENCE:SPEC:1009
PERSISTENCE:JAVADOC:199 (returned EntityResult[], for jakarta.persistence.SqlResultSetMapping.entities)
PERSISTENCE:JAVADOC:64
PERSISTENCE:JAVADOC:41
Since the current Spec text does not make it clear that an exception is expected for the negative test case idea (unless I am missing something), I do not think we need the TCK test to validate that an exception is thrown for the current test. More background on test assertions in general are listed on https://github.com/eclipse-ee4j/jakartaee-tck/wiki/Guide-to-adding-Specification-Assertions From my reading of the test change and the detail given about why the test needs to change, I think we should merge the change. Will leave it open for another day to see if we get more feedback first. Thanks for the help and contribution @beikov |
Note that this data change would simply show that the test is broken and would clearly show to implementers that their implementations (Hibernate, EclipseLink) just can't make this magic happen that the test seemed to expect. IMO, the test should simply be disabled or changed in a way such that it behaves like |
Could you paste in here what the updated |
Note that I can't add a challenge label to the issue |
Does anyone plan on updating this pr to update I expect that jakartaee/persistence#350 will be marked |
I can do that, I just need to know whether we want to adapt the test so that it works like |
As discussed in jakartaee/persistence#350 we will remove the |
See jakartaee/persistence#350 for further discussion
Fixes Issue
Specify the issue (link) that is solved with this pull request.
Related Issue(s)
Specify any related issue(s) links.
Describe the change
A clear and concise description of the change.
Additional context
Add any other context about the problem here.
CC @alwin-joseph @anajosep @arjantijms @cesarhernandezgt @dblevins @m0mus @edbratt @gurunrao @jansupol @jgallimore @kazumura @kwsutter @LanceAndersen @bhatpmk @RohitKumarJain @shighbar @gthoman @brideck @scottmarlow