6
« on: January 12, 2011, 03:11:25 am »
Please have a look at this if you are still interested in MDA Transformas for Unique and NotNull: unique is set as tag on the attribute
----------------------------------------------------
this is a response to a support question I asked months ago:
Thank you for your enquiry.
In addition to setting the "unique" property to the column you also need
to create a stereotyped operation to fully define the unique constraint
in your transformation.
The following example is a modified version of the "Attribute" template
for the DDL transformation that sets the "unique" property and creates
the required Operation.
We hope this helps. If you have any further questions, please feel free
to ask.
=== START TEMPLATE ===
$isUnique = %attTag:"Unique"%
$datatype=%CONVERT_TYPE(genOptDefaultDatabase,attType)%
Column
{
%TRANSFORM_CURRENT("type", "stereotype", "collection", "constant",
"containment", "ordered", "static", "volatile")%
type=%qt%$datatype%qt%
%if $isUnique == "TRUE"%
unique
%endIf%
}
%if $isUnique == "TRUE"%
Operation
{
name=%qt%UQ_%className%_%attName%%qt%
stereotype=%qt%unique%qt%
Parameter
{
name=%qt%%attName%%qt%
type=%qt%$datatype%qt%
}
}
%endIf%
=== END TEMPLATE ===
----------------------------------------------------
Also use the search button, find by message or header and go for posts dating back to more than a year. use mda or unique or transformation, not null as words to look for.
Sparx is right now changeing the nullable foreign key behaviour of the DDL tool, this might be of interest to you. In the physical model, after transformation took place, the multiplicity of the association between table classes let DDL tool decide, what fk is nullable and what is not.
let me know if you need more to get around your issue
Peter