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've ran into an issue with hierarchical associations combined with single table inheritance. The problem is that I get a
The Model for this: This only happends if the inheritance is SingleTableInheritance. If it is ConcreteTableInheritance or ClassTableInheritance I don't seem to get the error. Is this intended? |
|
|
Circular associations (e.g. self joins on the derived type) are not supported with STI unfortunately. CTI and ConcreteTableInheritance behave differently so this type of model is allowed in those cases.
|
|
|
Hey Johan, As a heads up, I'd think about how you handle this without CTI - things can get really messy with CTI and in certain scenarios LightSpeed doesn't handle querying that well with CTI. Do you absolutely require inheritance in your model? Life can be a lot more simple without it :-) Cheers, John-Daniel EDIT: Fixing you name, sorry for calling you Rohan originally! |
|
|
The reason we use inheritance is because we have two very core entities that are not only similar, but actually share properties and associations. The baseclass has multiple properties and several one-to-many associations with other entities. With inheritance we do not have to model those same relations twice. I started making a display-model trying to demonstrate the complexity of the data model, but after entity 'G' I realized that it wouldn't make much sense anyways. We almost have more associations than actual properties in this model, all of them intertwined. It is hard to explain without going in too deep on what we're actually modelling. To be honest, I'm pleasantly surprised that LightSpeed has been able to keep up so well considering the model we're throwing at it =) When initially reading up on the different types of inheritance we went with the STI, but I will explore the viability of the other two options as well. We worked around the MySql query error I posted about in another thread by making a new entity with two one-to-one associations with the target entity. We may be able to work around this error in a similar manner, introducing an additional entity with a one-to-one and an one-to-many relation //JohanW |
|
|
Hi Johan, I must pitch in before you go too far down the road with CTI. We started off with STI but soon our model was turning into a single-table-database. We switched to CTI - which was a costly exercise - and now we live with it and a certain amount of regret. Our code is littered with //HACK messages here and there where we are doing some ugly work-arounds because Lightspeed can't handle the complexity of our model using the CTI inheritance method. When time permits we are going to go BACK to STI. Somehow. Jason |
|