Hi all,
While there is still no unique constraint in Tamino, does anyone know if I can implement my own using X-Tension? If yes, should I go ahead by looking mapping functions’s onParse?? What I want is when a document is inserted into the database, a check will be performed using pre-defined unique attribute(s). Also, if the above sounds good, can X-Tension throw an exception (or TaminoError for Http Client for Java) to the accessor.insert(xmlobject) method if there is already document(s) having the same key exist in the database?
Or is there anyone already have a good implementation of unique key? The “ino:docname” approach is not very reliable and is very “ino-dependent”. Although the example of Jazz, which use the approach of create then query then commit/rollback, is reliable, it is a bit slow because it would be double the time than using the “ino:docname” approach.
By the way, does anyone know when will Tamino support unique key(s)?? Tamino 4.x at the end of this year?? If it support specifying in the schema (xs:unique) would be perfect.
Regards,
Lun
Hi Lun,
using Server Extension is a possible method when developing unique constraints.
With current X-Tensions however, You have to be aware that the evaluation function is “responsible” for storing the respective (sub-) document, too. This can best be
done via XMLCallback functions in the Server Extension, but a second doctype and
special Compose Mapping becomes necessary. According to current plans, Tamino v4.1 will comprise a feature called “trigger” which will allow to execute user written functions during processing independent of mapping. This will probably better suit your demands.
In both cases (mapping or trigger) the Server Extension may throw an exception, which will cause the request to fail with a result document.
For details of exception handling please see the documentation.
Best regards, Michael