[JIRA] (HHH-16572) Bad enhancement for PROPERTY attributes with mismatched field and method names
by Steve Ebersole (JIRA)
Steve Ebersole ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiN2Q0NTYyN2I0... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16572?atlOrigin=eyJpIjoiN2Q0NT... ) HHH-16572 ( https://hibernate.atlassian.net/browse/HHH-16572?atlOrigin=eyJpIjoiN2Q0NT... ) Bad enhancement for PROPERTY attributes with mismatched field and method names ( https://hibernate.atlassian.net/browse/HHH-16572?atlOrigin=eyJpIjoiN2Q0NT... )
Change By: Steve Ebersole ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
Consider the model :
{code:java}@Entity
public static class Spouse {
...
private String last;
@Id
Integer getId() {...};
String getLastName() {...};
void setLastName(String name) {...};
}{code}
Here, we have PROPERTY access (getter and setter) because of the placement of {{(a)Id}}. which in turn means that we have a persistent attribute named {{lastName}}based on the getter method name.
This confuses the enhancer which always works from the field name. Here, it thinks the persistent attribute is named {{last}}.
----
Jakarta EE 10 TCK test jpa/core/query/flushmode ( #flushModeTest5 ) [https://github.com/jakartaee/platform-tck/blob/master/src/com/sun/ts/test...] fails.
The tests that fail with vehicle names:
* flushModeTest5_from_appmanagedNoTx
* flushModeTest5_from_pmservlet
* flushModeTest5_from_puservlet
* flushModeTest5_from_stateless3
The same tests pass with bytecode enhancement disabled.
The test output contains:
[javatest.batch] ^[[0m^[[0m12:24:15,206 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: Wrong collection size returned (expected 1, got 0)
[javatest.batch] ^[[0m^[[0m12:24:15,207 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: Wrong size returned, expected PKs of (11), got PKs of ()
[javatest.batch] ^[[0m^[[0m12:24:15,207 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: Did not get expected results. Expected 1 reference, got: 0
[javatest.batch] ^[[0m^[[0m12:24:15,207 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: flushModeTest5 failed
[javatest.batch] ^[[0m^[[0m12:24:15,207 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: Test case throws exception: flushModeTest5 failed
[javatest.batch] ^[[0m^[[0m12:24:15,207 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: Exception at:
[javatest.batch] ^[[0m^[[0m12:24:15,208 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: com.sun.ts.lib.harness.EETest$Fault: flushModeTest5 failed
[javatest.batch] ^[[0m^[[0m12:24:15,209 INFO [stdout] (Thread-197) at deployment.jpa_core_query_flushmode_vehicles.ear.jpa_core_query_flushmode_appmanagedNoTx_vehicle_ejb.jar//
( https://hibernate.atlassian.net/browse/HHH-16572#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16572#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:55ea0c5 )
2 years, 11 months
[JIRA] (HHH-16572) Bad enhancement for PROPERTY attributes with mismatched field and method names
by Steve Ebersole (JIRA)
Steve Ebersole ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiOGRkMTlkMGRm... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16572?atlOrigin=eyJpIjoiOGRkMT... ) HHH-16572 ( https://hibernate.atlassian.net/browse/HHH-16572?atlOrigin=eyJpIjoiOGRkMT... ) Bad enhancement for PROPERTY attributes with mismatched field and method names ( https://hibernate.atlassian.net/browse/HHH-16572?atlOrigin=eyJpIjoiOGRkMT... )
Change By: Steve Ebersole ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
Consider the model :
{code:java}@Entity
public static class Spouse {
...
private String last;
@Id
Integer getId() {...};
String getLastName() {...};
void setLastName(String name) {...};
}{code}
Here, we have PROPERTY access (getter and setter) because of the placement of {{(a)Id}}. which in turn means that we have a persistent attribute named {{lastName}}based on the getter method name.
This confuses the enhancer which always works from the field name. Here, it thinks the persistent attribute is named {{last}}.
----
Jakarta EE 10 TCK test jpa/core/query/flushmode ( #flushModeTest5 ) [https://github.com/jakartaee/platform-tck/blob/master/src/com/sun/ts/test...] fails.
The tests that fail with vehicle names:
* flushModeTest5_from_appmanagedNoTx
* flushModeTest5_from_pmservlet
* flushModeTest5_from_puservlet
* flushModeTest5_from_stateless3
The same tests pass with bytecode enhancement disabled.
The test output contains:
[javatest.batch] ^[[0m^[[0m12:24:15,206 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: Wrong collection size returned (expected 1, got 0)
[javatest.batch] ^[[0m^[[0m12:24:15,207 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: Wrong size returned, expected PKs of (11), got PKs of ()
[javatest.batch] ^[[0m^[[0m12:24:15,207 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: Did not get expected results. Expected 1 reference, got: 0
[javatest.batch] ^[[0m^[[0m12:24:15,207 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: flushModeTest5 failed
[javatest.batch] ^[[0m^[[0m12:24:15,207 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: Test case throws exception: flushModeTest5 failed
[javatest.batch] ^[[0m^[[0m12:24:15,207 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: Exception at:
[javatest.batch] ^[[0m^[[0m12:24:15,208 INFO [stdout] (Thread-197) 05-02-2023 12:24:15: SVR-ERROR: com.sun.ts.lib.harness.EETest$Fault: flushModeTest5 failed
[javatest.batch] ^[[0m^[[0m12:24:15,209 INFO [stdout] (Thread-197) at deployment.jpa_core_query_flushmode_vehicles.ear.jpa_core_query_flushmode_appmanagedNoTx_vehicle_ejb.jar//
( https://hibernate.atlassian.net/browse/HHH-16572#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16572#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:55ea0c5 )
2 years, 11 months