To protect the changes that you make to the entities that the UML-to-JPA
transformation generates, you must alter the @generated annotation or add
code only to specific locations in the generated code.
About this task
To protect the changes that you make to the generated entities,
complete one of the following steps:
- Remove the @generated annotation
- Alter the @generated annotation, as in this example: @wasgenerated.
Inserting characters can help you to identify the generated code that the
transformation does not overwrite when you rerun the transformation.
Note: If
you remove or alter the @generated annotation, the next time that you run
the transformation, it does not update the code with the changes to the model.
To
propagate model changes to the code after you remove or alter the @generated
annotation, you must complete one of the following steps:
- Add an @generated annotation to the element from which the annotation
was deleted
- - Undo changes to the original @generated annotation
- Add code only between the following comments in the generated code:
// begin-user-code
// end-user-code
Note: The transformation always preserves the
code between these comments, whether or not you remove or edit the @generated
annotation.
To protect annotations that correspond to stereotypes in the EJB
3.0 Transformation profile or the JPA profile, complete one of the following
steps:
- Include the annotation details in the corresponding stereotype in the
source model
- Run the JPA-to-UML transformation
Completing either of these steps ensures that annotation details are
not removed when you reconcile changes during the iterative development process.
The
transformation does not overwrite annotations that do not have corresponding
stereotypes in the EJB 3.0 Transformation profile or the JPA profile.