The UML-to-Java transformation and the UML-to-JPA transformation
add the @generated annotation, which also called the @generated tag,
to certain generated elements. When you rerun a transformation, the
transformation overwrites elements that contain the @generated tag.
The transformation also overwrites qualifiers
and members of classes, and qualifiers, parameters, and the body of
methods.The UML-to-JPA transformation adds the @generated tag to the following
generated elements:
- Classes
- Interfaces
- Fields
- Methods
Other annotations
If an annotation in the
generated code has a corresponding stereotype in the **EJB and JPA***
profiles, the UML-to-JPA transformation overwrites the annotation
when you rerun the trasnforamtion.
The transformation does
not overwrite annotations that do not correspond to a stereotype in
the profiles.
Consider the following example:
A UML model
contains a class that has the following characteristics:
- The Entity stereotype is applied to it
- It contains a UML property that has the ID and GeneratedValue
stereotypes applied to it.
- In the GeneratedValue stereotype, the value of the strategy property
is set to 1 - Identity.
After you run the UML-to-JPA transformation, the generated
code contains the following annotation:@GeneratedValue(strategy
= GenerationType.IDENTITY)
In the generated code, suppose
that you change the annotation as shown below:@GeneratedValue(strategy
= GeneratedValue.TABLE)
Depending on the design contract
modeling protocol (DCMP) that you select in the transforamtion confgiruation,
the followign events occur:
- If the transforamtion uses the Conceptual, DCMP...
- If the transforamtion uses the Mixed Modeling DCMP...
- If the transforamtion uses the Reconciled Mdeling DCMP, to synchornize
the model and code you must either maek the corresponding change to
the property in the model, or run the JPA-to-UML transforamtion.