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

SQL query is not created properly if foreignKey is reference to a table with multiple primaryKey #1739

Open
punnyaannjoy opened this issue Jun 14, 2024 · 3 comments

Comments

@punnyaannjoy
Copy link

punnyaannjoy commented Jun 14, 2024

Wrong SQL query is generated when parent table having more than one primary key is referenced through foreign key in the child table

DBFlow Version: 4.2.4

Bug or Feature Request:
Fix the logic for creating SQL query when Parent table with more than 1 primary key is referenced through foreignKey in the child table

Description:

When a child table reference a parent table (having more than one primaryKey) through Foreign Key, the SQL query generated for the child table is wrong

Here is the example of the query generated for UPDATE operation.

@OverRide
public final String getUpdateStatementQuery() {
 return "UPDATE ContactPhoneMapping SET contact_primaryId=?,contact_secondaryId=?,phoneNo=?,type=? WHERE contact_primaryId=?,contact_secondaryId=? AND phoneNo=?";
}


Notice that "AND" is missing in the where condition for "contact_primaryId" and "contact_secondaryId"

@loquitowen
Copy link

loquitowen commented Jun 14, 2024 via email

@punnyaannjoy
Copy link
Author

@agrosner any suggestion on the above issue?

@loquitowen
Copy link

loquitowen commented Jul 10, 2024 via email

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

No branches or pull requests

2 participants