This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi guys, I get the following error "Expected single child entity but found multiple" when saving a entity is there anyway that I can see which entity is causing this? Thank you, Johan
|
|
|
It looks like this is not reported at the moment. However it will be an entity that is participating in a one-to-one relationship, which might cut down the number of candidates. We'll see if we can improve the error reporting here -- thanks for pointing this out. |
|
|
Just to let you know that we have updated the error message so that in future nightly builds it will show the types of the related entities and the ID of the first associated entity. From this it should be possible to determine the parent which has multiple instances of the one-to-one association. Hope this helps! |
|
|
Hi Ivan, Thank you for adding detail to the message. This helped me to understand what going on. Attached is the image of the model. I get the problem when trying to persist the Task entity with the category. Because my Category is 1 to 1 to task when I try to save I get the previous error. Regards, Johan J v Rensburg
|
|
|
Hi Johan, "A task can only have one category. But [ a ] category can be assigned to many tasks." Unless I'm misunderstanding something, this should be modelled as a one-to-many relationship from Category to Task (and, implicitly, a many-to-one relationship from Task to Category). Then each Task will have one Category (modelled in LightSpeed as a CategoryId and an EntityHolder<Category>), but a Category will be able to refer to multiple Tasks (modelled in LightSpeed as an EntityCollection<Task>). You should be using a one-to-one association only if, in addition to each Task having one Category, each Category has only one Task. Hope this makes sense -- if I've misunderstood your scenario then please do correct me! |
|
|
Hi Ivan, I knew I was doing it wrong. Thank you so much Johan |
|