Accelerating JPA Development with UML-TO-JPA transformations in RSA V7.5

Source: Internet
Author: User
Tags object model object serialization

This article describes the latest UML-TO-JPA transformations in Rational Software Architect (RSA) V7.5, which allows users to design JPA configuration and data models on the UML object model, and to quickly generate Java classes with JPA annotations that can Developers are freed from frequent repetitive work. When the changes in the model and code are brought about by the change of requirements during the development of O/R Mapping, the RSA UML-TO-JPA conversion tool can effectively reduce repetitive work in project iterations, and it is also helpful to ensure the consistency of object model and data model. It is of great practical significance for both the application developer and the design staff.

This article is designed for Java persistence developers and designers, assuming the reader has a basic understanding of Java O/R Mapping and JPA, and you can also see resources to learn more about JPA and Java persistence-related knowledge. This article will focus on using JPA transformation to develop JPA applications.

Preparatory work

Introduction to JPA

Persistence has been a topic of concern for Java developers, because the persistence of the EJB is too heavy to produce a lot of Java persistence Framework, O/R Mapping can liberate us from the heavy database storage and object serialization work, and enables the developer to be flexible to respond to the demand change The changes in the database and the changes in the object model can reduce the code changes that sustain the mapping between them. The latest JPA specification provides the standard API and configuration for Java persistence, while supporting annotations and configuration files. In the actual use of the process, we realize the JPA function of the powerful, but also feel a certain degree of inconvenience. When you use a mapping profile, a small change in the database or object model requires that you modify the configuration file, and if you use annotations, although the elements are bound to Java code, if the code is converted from models such as UML, then you need to add the annotations of the JPA elements again after each modification. At the same time, annotations are scattered in each Java class file, the lack of an effective centralized management mechanism, modification and maintenance is not very convenient. So if we can switch directly from the UML model to the JPA annotations, we can manage JPA metadata consistently at the model level, greatly reducing the developer's workload. This article will focus on how to configure the JPA transformation profile and stereotype in RSA7.5, and will not detail the JPA annotations themselves and the general methods of RSA's development of JPA, and if necessary, refer to the relevant information.

JPA Transformation UML Profile

Starting with UML2.0, the UML specification introduces a very important concept: UML profile, which allows UML languages to be adapted to specific areas, allowing users to freely implement a customized UML profile, and based on the extensibility of these UML profiles to create special The domain model that is fixed. UML Profile provides a simple extension mechanism for domain-independent UML to support the definition of domain-specific entities and rules. The latest version of RSA7.5 has built-in UML profiles that help us develop and model, including the JPA transformation profile we use in this article. You can refer to the article "UML 2.0 profile for software services" to learn more about using UML profile in RSA. Profile consists primarily of stereotype (stereotypes) that define which UML class (meta Class) is associated with it, the attributes on that class, and the constraints on how the stereotype element is associated with other elements. For example, in the JPA transformation profile in RSA, the Entity stereotype extends the class UML meta class. It shows that we can declare a UML Class as an entity within the domain of JPA. Also for attributes in the Entity class, profile provides some of the stereotypes that we can apply to them, such as id,column, by applying different stereotypes to the object model and setting the corresponding attribute values for those stereotypes, JPA transformation profile Allows us to fully express the JPA semantics. With the JPA transformation feature, a custom class diagram can be transformed directly into a annotated JPA Java class, speeding up the development process of using JPA as a persistence layer and keeping the object model and persistence model in line.

UML model used by the sample

This article will use the object model described in Figure 1 as an example to illustrate how to use the UML-TO-JPA transformation in RSA to accelerate the development of JPA.

Figure 1. Example uses the object model

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.