I have an entity User entity which is a parent entity to a Friend entity.

The User entity has a to-many relationship with an entity named Article.

The idea is there are users saved and also friends (from Facebook), the to-many relationship to Article is set on the User entity as this is being subclassed by Friend.

My question is how can I request all Articles by Friends and not by all users ?

I am having trouble setting an Predict to omit User entities and keep only Friend entities.

Thanks.

有帮助吗?

解决方案

Is there a reason you are building a parent/child entity design here? Parent/Child entities come with a really heavy cost if you are persisting to a sqlite store. It is almost always a better idea to just have a single entity and have a flag stating if it is a friend.

Also, I know of no way, at the database level, to filter out the parent from the child in this design. It can be done in memory after the fetch by requesting the entity.name but that will not turn into a sql call properly.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top