Skip to content
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

fix issue with multi-joins #567

Merged
merged 2 commits into from
Jun 4, 2020
Merged

fix issue with multi-joins #567

merged 2 commits into from
Jun 4, 2020

Conversation

sdelamo
Copy link
Contributor

@sdelamo sdelamo commented Jun 3, 2020

Only appends join if it was not appended before

Close #457

@sdelamo sdelamo added this to the 1.1.0 milestone Jun 3, 2020
@sdelamo sdelamo requested a review from graemerocher June 3, 2020 11:30
alias,
escape ? quote(getColumnName(associatedId)) : getColumnName(associatedId),
joinColumnNames[0]);
if (target.indexOf(join.toString()) == -1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you are converting the builder to a string at this point it makes sense to use the same converted variable to append to the target otherwise toString() will be called twice which is not super efficient

Also you can make just use target.contains(..) instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target is of type StringBuilder, it does not have contains method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you are converting the builder to a string at this point it makes sense to use the same converted variable to append to the target otherwise toString() will be called twice which is not super efficient

I've done the change so that toString() is called only once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generated SQL is wrong when using multiple @Join annotations
2 participants