Hi
I created a new schema and defined the unique constraint as specified in the documentation, adding the SXS in the trigger and creating the appinfo.
At first, the constraint does not allow me to add new instances to Tamino. The only way I can get the constraint to work correctly, is to remove the trigger, add some (duplicate) instances without the constraint, then add the trigger to the schema and redefine it to Tamino. After this I am correctly prohibited from adding duplicates and can add unique instances.
So it seems that only once the contraint has ‘kicked in’ by doing some validations on current instances does it work properly.
This seems bizarre. What am I doing wrong? I am using Tamino 4.1.4.1 and have loaded the hotfix H4_1_4_208.
The schema is
<?xml version = "1.0" encoding = "UTF-8"?>
<xs:schema elementFormDefault = "qualified" xmlns:tsd = "http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition" xmlns:xs = "http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<tsd:schemaInfo name = "AccountTypeCode">
<tsd:collection name = "sdl"></tsd:collection>
<tsd:doctype name = "AccountTypeCode">
<tsd:logical>
<tsd:content>closed</tsd:content>
</tsd:logical>
</tsd:doctype>
</tsd:schemaInfo>
</xs:appinfo>
</xs:annotation>
<xs:annotation>
<xs:appinfo>
<tse:schemaExtension xmlns:tse = "http://namespaces.softwareag.com/tamino/TaminoSchemaExtension">
<tse:doctype name = "AccountTypeCode">
<tse:unique name = "AccountType-key">
<tse:field xpath = "."></tse:field>
</tse:unique>
</tse:doctype>
</tse:schemaExtension>
</xs:appinfo>
</xs:annotation>
<xs:element name = "AccountTypeCode" type = "xs:string">
<xs:annotation>
<xs:appinfo>
<tsd:elementInfo>
<tsd:logical>
<tsd:trigger>
<tsd:onInsert type = "action">UniqueConstraintSXS.onInsert</tsd:onInsert>
<tsd:onUpdate type = "action">UniqueConstraintSXS.onUpdate</tsd:onUpdate>
</tsd:trigger>
</tsd:logical>
</tsd:elementInfo>
</xs:appinfo>
<xs:documentation>Type of bank account (i.e. current, credit etc.)</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
Regards
Elsabe Jacobs