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, I am getting the circular association error for one to many relationship between two tables. I have this kind of relationship with other tables, I am not sure why I am getting this error on these two tables. Please, let me know how to fix it. Circular associations are not supported by LightSpeed: [TableObject.Attachments and Attachment.TableObject] Thanks!
|
|
|
Could you post your model please? It's hard to say what might be different about these two entities without seeing the code. Thanks! |
|
|
Thanks for your help. I have pasted the class code generated for Attachment and Object table. Attachment table code:---------------------------------------------------------------- <Serializable()> _ --------------------------------------------------------------
TableObject code: --------------------------------------------------------------------- <Serializable()> _ |
|
|
Thanks. Could you also post AttachmentType please, just so we can get a full picture of the associations involved (I don't *think* this can be an indirect circular association, but I'd like to be sure!). I also noticed that TableObject inherits from TwistEntity(Of Integer). Can you confirm that TwistEntity doesn't introduce any associations or other persistent fields? Thanks! |
|
|
I don't think Attachment type should be an issue but I have posted the code below. TwistEntity just inherits Entity class and inculdes common fields of all the tables. Attachment type table: <Serializable()> _ ---------------------------- TwistEntity code: -------------- Public MustInherit Class TwistEntity(Of T) |
|
|
The problem appears to be that in the Attachment class, there is no foreign key field for the TableObject association. This makes LightSpeed think that the TableObject association is the "parent" (PK) end of a one-to-one association. So now it has an association both ends of which appear to be "parent" ends, neither of them having a foreign key, which it interprets (rather misleadingly I admit) as a circular association. Now I suspect that what you actually intend is that the _objectId field be the foreign key for the TableObject association. In this case in needs to be named _tableObjectId so as to match up with the _tableObject EntityHolder. However the designer should really be creating this field for you and I am not sure why it is not doing so (or is giving it the wrong name). If you have copied these files from the ones generated by the designer, and edited them by hand, then all you need to do is change _objectId to _tableObjectId. If these files are the ones generated by the designer, could you provide your .lsmodel and .lsmodel.diagram files so we can try to figure out why the foreign key field is not being generated or is being generated incorrectly? Thanks! |
|