-
Notifications
You must be signed in to change notification settings - Fork 166
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
SQL generation fix for EOKeyValueQualifiers when key is key path with derived attribute #828
Conversation
ERXEC.DefaultFactory's _createEditingContext() uses the er.extensions.ERXEC.editingContextClassName property to determine the name of the class to be instantiated when creating an editing context. It defaults to er.extensions.eof.ERXEC.
where the key is a key path (with two or more keys) and the last key is a derived attribute. For example, "customer.fullName" where the last key fullName is defined as: 'firstName || ' ' || lastName.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please ignore the changes to the flying saucer .jar files. I had a conflict when I merged wonder master into my clone and this is just an artifact of that. The fix for this pull request is on ERExtensions.java only.
…E … GROUP BY … HAVING … ORDER BY …” using EOF/Wonder constructs (EOQualifiers, key paths, ERXKeys, EOAttributes, EOSortOrderings, etc.)
I learned how to use feature branches to create pull requests that contain only the change that needs to be applied to Wonder. I have created a separate pull request for this that excludes the stuff that is needed and includes only the change to ERXExtensions.java which is the only thing needed. |
Overview
This bug fix can be disabled with a property and everything works just like before. The fix will be enabled by default and the property to disable it is named
er.extensions.KeyValueQualifierSQLGenerationSupport.handlesKeyPathWithDerivedAttribute
.The fix adds SQL generation support for EOKeyValueQualifiers in an edge case where the key is a key path (with two or more keys) and the last key references a derived attribute.
Example #1:
The the key in the key-value qualifier is
customer.fullNameReversed
and the last key fullNameReversed is defined as:lastName || ', ' || firstName
.Example #2:
A more complex example I tested involves a key-value qualifier with the key
claim.patientAge
wherepatientAge
is a derived attribute that is defined asTRUNC(MONTHS_BETWEEN(dateOfService,patient.birthDate)/12,0)
. My object model has a Claim entity, a LineItem entity and a Patient entity.My test:
This test uses both
Without the fix, EOF throws an exception. With the fix the SQL is generated perfectly as follows: