foreignkey

Hi all, i am trying to define 2 schemas. There is a 1:n relationship between them. e.g. user and organization. So i define the @userId and @orgId as uniqueKey of the userSchema. Is there any feature of Tamino, that can check whether the orgId exists, when i insert a instance of user? Regards chacha

Hi unfortunately, there is no builtin functionality for foreign keys. You may create a server extension (trigger) for the user which checks the presence of the org, and another trigger checking whether an org to be deleted is referenced by any user. However, that approach most likely will imply race conditions or locking issues (similar to a server extension for uniqueness, which had been developed before it had been implemented inside the server). Best regards Uli

Hi Uli, thanks for all. Is it better to create a trigger in tamino ( with the locking-issues) or write a piece of program in the application to get the control? In my case, what is the best way to define the schemas with 1:n relation? Best Regards chacha

Hi you will run into the race-condition or locking issues in both variants. The advantage of using a trigger, that the constraint applies also to another application not explicitly prepared for the 1:n relation. Regards Uli