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

[master] Bug 391279: Fix usecase with existing FK mapping #471

Merged
merged 1 commit into from
Jun 27, 2019

Conversation

dazey3
Copy link
Contributor

@dazey3 dazey3 commented Jun 18, 2019

for #233

The original 391279 did not account for the usecase of an existing foreign key mapping on the owning side and instead expected the FK would be added by the @joincolumn. This results in an exception similar to this:

Execute query InsertObjectQuery(model.CommentC@378deffb)
INSERT INTO COMMENTC (COMPLEXID_C_A, CONTENT, COMPLEXID_C_A, TYPE) VALUES (?, ?, ?, ?)
Internal Exception: java.sql.SQLSyntaxErrorException: Column name 'COMPLEXID_C_A' appears more than once times in the column list of an INSERT statement. 

The issue is due to the use of ObjectBuilder.buildRow(AbstractRecord databaseRow, Object object, AbstractSession session, WriteType writeType) in OneToManyMapping. This method calls DatabaseMapping.writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, WriteType writeType), which adds to the given row, causing duplicates.

Signed-off-by: Will Dazey dazeydev.3@gmail.com

Signed-off-by: Will Dazey <dazeydev.3@gmail.com>
@dazey3 dazey3 requested a review from lukasj June 18, 2019 22:30
Copy link
Member

@lukasj lukasj left a comment

Choose a reason for hiding this comment

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

LGTM

@dazey3
Copy link
Contributor Author

dazey3 commented Jun 19, 2019

@lukasj thanks for the reviews!

@dazey3 dazey3 merged commit 264faaf into eclipse-ee4j:master Jun 27, 2019
@dazey3 dazey3 deleted the 391279_v2_master branch June 27, 2019 15:50
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.

None yet

2 participants