Check the Problems view for information about missing stereotypes.
You can specify the following elements as sources for the UML-to-JPA transformation:
The transformation transforms the contents of UML models, packages, classes, and interfaces. For example, when the transformation transforms a class, the transformation also transforms the operations and properties of the class.
If you select a model or model elements in the Project Explorer view instead of using the Transformation Configuration editor, the model or elements that you select override the source model or elements that you specify in the transformation configuration. The transformation configuration is not affected and the source that you specify on the Source and Target page of the transformation configuration editor or in the New Transformation Configuration wizard does not change.
The transformation can generate output to a JPA project or Java project, or a source folder in a JPA project or Java project. You can create the JPA project with or without a client project. The transformation generates code in the first detected source folder of the JPA project and in the first detected source folder of the client project, if one exists.
When you configure the transformation to generate a deployment descriptor, it generates all JPA annotations in the persistence files, and does not generate JPA annotations in the Java code.
You can use the UML-to-JPA transformation to create trace relationships from the generated Java classes to the UML source elements. You can then view the trace relationships in a topic diagram by creating and running model queries.
Creating trace relationships is useful in large projects that might contain multiple models and multiple transformation configurations. You can also create and run traceability queries that display how the transformation output relates to software specifications and model elements.
When you rerun the transformation, if necessary, the transformation uses the identifier in the source code to match corresponding elements and then changes the code to reflect the changes to the model. For example, if you rename a UML operation in the source model and rerun the transformation, the transformation renames the previously generated Java method and preserves the method body, instead of deleting the previously generated method and adding a new method.
The JPA-to-UML, or reverse, transformation can also use the identifiers to match corresponding elements between the Java project and the UML model. If applicable, changes to the Java source code elements are treated as modifications or as code refactoring instead of additions and deletions to the generated code.
| UML element | Transformation output | Trace relationship in a class diagram |
|---|---|---|
![]() |
/**
*
*/
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Entity;
import java.io.Serializable;
/**
* <!-- begin-UML-doc -->
* <!-- end-UML-doc -->
* @uml.annotations
* derived_abstraction="platform:/resource/Miscellaneous%20Models/Blank%20Package1.emx#_sQ4U4J-QEd2RedZBNurApQ"
* @generated "sourceid:platform:/resource/Miscellaneous%20Models/Blank%20Package1.emx#_sQ4U4J-QEd2RedZBNurApQ"
*/
@Entity
@NamedQuery(name = "EntityClass.findByid", query = "select obj from EntityClass where obj.id = :id")
public class EntityClass implements Serializable {
/**
* <!-- begin-UML-doc -->
* <!-- end-UML-doc -->
* @generated "sourceid:platform:/resource/Miscellaneous%20Models/Blank%20Package1.emx#_sRjDQZ-QEd2RedZBNurApQ"
*/
@Id
private Integer id;
/**
* @return the id
* @generated "sourceid:platform:/resource/Miscellaneous%20Models/Blank%20Package1.emx#_sRjDQZ-QEd2RedZBNurApQ?GETTER"
*/
public Integer getId() {
// begin-user-code
return id;
// end-user-code
}
/**
* @param id the id to set
* @generated "sourceid:platform:/resource/Miscellaneous%20Models/Blank%20Package1.emx#_sRjDQZ-QEd2RedZBNurApQ?SETTER"
*/
public void setId(Integer id) {
// begin-user-code
this.id = id;
// end-user-code
}
/**
/**
* <!-- begin-UML-doc -->
* <!-- end-UML-doc -->
* @generated "sourceid:platform:/resource/Miscellaneous%20Models/Blank%20Package1.emx#_s0NrcJ-QEd2RedZBNurApQ"
*/
public void Operation1() {
// begin-user-code
// TODO Auto-generated method stub
// end-user-code
}
/**
* <!-- begin-UML-doc -->
* <!-- end-UML-doc -->
* @generated
*/
private static final long serialVersionUID = 0;
/**
* <!-- begin-UML-doc -->
* <!-- end-UML-doc -->
* @generated
*/
public EntityClass() {
}
|
![]() |
The transformation does not alter the source model when you specify that the transformation generate trace relationships.
The transformation provides integration functionality with IBM® Rational® Team Concert, CVS, Rational ClearCase®, and Rational ClearCase LT version control systems, which enables you to automatically check out files or add new files. You must enable team capabilities to work with configuration management systems.