-
Notifications
You must be signed in to change notification settings - Fork 236
Relationships do not create the correct sub-entity #112
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
Conversation
…he entityType column is also included so the resolved entity can be obtained
I've also updated the project a bit to use XCTest and fixed some warnings. |
… to the table if the destination relation is part of a entity hierarchy
…he root entity column name is used
…returned so the correct subclass of entity can be created
…leting and updating objects
…mns types needed to be added, this is to distinguish the difference between table creation and fetch requests
I think the issue should be fixed now! I might try add a few more test cases to just ensure any edge cases are fixed... |
… is done when querying for the entities properties
…ype a JOIN is done when getting new values for many-to-many relationships
Many-to-many relationships fixed in commits 8ea8aa3 |
…pe using the SQL BETWEEN expression
I've also added support for the I think this is ready for a merge now, like I said above I might make some more test cases. Also a note here that this should probably be tagged as 3.0 as it contains breaking changes from previous versions which cannot be migrated as these schemes did not have the |
Hi @rhodgkins, Wow this is a great update, that hopefully puts to rest most of the many relationship issues. Sorry it took a while to get a response out to you. Appreciate you taking the time to show us the entity diagram. That definitely helped make sense of the new changes. It's a pretty good sized rework that was really needed. Changing things to be tied to the super entity definitely looks like the right thing to do. I'm glad you thought through it that much, makes more sense than how we originally had it (Tied to the subentities). Also doing the JOIN for many-to-many while tracking the type seems like it was pretty much required to get things to work properly. Merging in the pull request now, and will tag it as 3.0 to avoid any confusions. Thanks again for your contributions! |
Relationships do not create the correct sub-entity
@gavin-black no problem happy to help with such a great and useful framework :) |
I'm going to try to explain this but it might be better having a look at the object graph and test cases!
Root
allows sub entities ofParent
to be stored against it, but theParent
entity description of any subentites is returned instead of the specificChildA
orChildB
entity descriptions.730554f adds 2 failing test cases for one-to-one and many-to-many relationships.
This was fixed in the same way as when fetching entities based on parent entities, looking up the hash of the entity name from
entityTypeCache
(line 231 and 267).I think this also needs to be applied to the other 2 relational types.
I think these types of relationships with subentites will need a join on the destination entities table (where appropriate) so instead of:
There should also be another column for the type of the
oneToOne
entity:This has deeper issues as the relation table name columns are based on the relational subentities not its parent entities. For example the following table is created for the above object graph:
But the primary key column need to be based on the super entity:
And also when querying for many-to-many relations a
JOIN
needs to be performed, and the type column added if needed:I'm going to try looking at the other issues, but I think I'm along right lines with the last 2 issues?