What Is Instant Code Reverse: Hibernate?
Instant Code Reverse: Hibernate is a reverse engineering feature in Visual Paradigm Desktop that converts Hibernate mapping files into UML model elements. It allows developers to extract structural information from an existing Hibernate-based application and represent that information in a visual modeling environment.
Instead of manually recreating classes and package structures from Hibernate mapping definitions, developers can use Instant Reverse to analyze the source files and bring the resulting model elements into a Visual Paradigm project. The reversed elements can then be organized in the Model Explorer, reused in other modeling activities, or displayed in UML diagrams.
The feature is particularly useful when working with existing applications, legacy systems, or projects where Hibernate mapping files already define the persistence-related structure. It provides a way to move from implementation-level mapping information to a visual model that can be inspected and documented.
Why Use Instant Code Reverse for Hibernate?
Hibernate mapping files describe how application objects relate to persistent data. However, understanding these definitions directly from source files can become difficult as an application grows. Reverse engineering helps transform this information into a more accessible visual representation.
Recover Existing Model Structure
Reverse engineer Hibernate mapping files to reconstruct UML model elements without manually creating every element from scratch. This is useful when the original design model is unavailable or when developers need to recover structural information from an existing implementation.
Understand Persistence Design
Bring Hibernate mapping information into a modeling environment where developers can inspect the resulting model elements and better understand the structure represented by the mappings.
Support Legacy System Maintenance
When maintaining an established application, the original design documentation may be outdated or incomplete. Reversing Hibernate mapping files provides a starting point for reconstructing a visual representation of the existing system.
Create Visual Documentation
Use the reversed model elements to form UML diagrams, making it easier to communicate system structure, review implementation decisions, and document existing applications.
Organize Reversed Models
Specify the destination model for reversed elements. This makes it possible to keep recovered structures separate from other parts of a project, such as existing designs, prototypes, or legacy-system models.
Edition and Availability
Instant Code Reverse: Hibernate is part of Visual Paradigm Desktop’s code engineering capabilities. Hibernate-related reverse engineering is available in the Enterprise, Professional, and Standard editions.
It is not listed as an available feature in the Modeler or Community editions. Availability may also depend on the specific reverse engineering workflow being used, so users should consult the current Visual Paradigm edition comparison when checking their license.
Functionality Breakdown
Instant Code Reverse: Hibernate provides a workflow for reading Hibernate mapping files, creating UML model elements, organizing the resulting elements, and optionally generating diagrams from the reversed model.
Hibernate as the Reverse Engineering Language
The Instant Reverse dialog provides a Language selection that determines the type of source files Visual Paradigm will process. Select Hibernate when the input consists of Hibernate mapping files.
This selection tells Visual Paradigm to use its Hibernate reverse engineering support rather than a reverse engineering parser intended for another programming language or source format.
Source File and Folder Selection
The Path field specifies the input location for the reverse engineering operation. You can provide:
- A source file: Use a specific Hibernate mapping file when you want to reverse engineer an individual file.
- A folder: Use a directory containing the Hibernate mapping files when you want to process a collection of source files.
Choosing the appropriate input path helps ensure that Visual Paradigm processes the intended Hibernate source material.
Update Type: Handling Duplicate Classes
The Update Type option determines how Visual Paradigm handles classes that already exist in the project when the reverse engineering process encounters duplicate class definitions.
The available behaviors are:
- Update duplicate class(es): Updates existing classes using information from the reversed source. This option is useful when refreshing a model to reflect changes in the source files while retaining the existing model elements.
- Replace duplicate class(es): Discards the existing duplicate classes and replaces them with the classes reversed from the source. This option is useful when the source should take precedence over the existing model definitions.
Choose the update behavior carefully, particularly when working with an established model that may contain manually maintained information.
Reverse to Model
The Reverse to Model option specifies the parent model in which Visual Paradigm places the reversed model elements.
You can use this option to organize recovered elements into an existing model or create a new model specifically for the reversed content.
To choose the destination model:
- Click the … button at the end of the Reverse to Model row.
- In the Select Parent Model window, select an existing model or click New Model to create one.
- Click OK to confirm the selection.
For example, you might place recovered legacy application structures under a model named Old and prototype structures under a model named Prototype. This helps keep different model areas logically separated.
Reverse to Diagram
The Reverse to Diagram option controls whether Visual Paradigm also generates a diagram from the reversed source information.
When package diagram reverse engineering is selected, Visual Paradigm produces UML packages and the relationships between them. This provides a visual representation of the package structure represented by the source files.
Diagram generation is optional. You can reverse the model elements first and decide how to visualize them later.
Forming a Class Diagram After Reverse Engineering
After the reverse engineering operation finishes, Visual Paradigm displays the Instant Reverse Form Diagram window. This window allows you to select reversed classes and configure how they should appear in a newly generated class diagram.
You can select the classes to include, choose which relationships to display, and configure the presentation of attributes, operations, and types.
If you do not want to create a diagram immediately, click Cancel. This does not cancel or discard the reverse engineering operation. The reversed classes remain available in the Model Explorer or Class Repository and can be used to form a diagram later.
Select Class
The Select Class tab displays the classes reversed from the source code in a tree structure.
Select the classes that you want to include in the generated class diagram. At least one class must be selected before a diagram can be formed.
Consider the number of selected classes when generating a diagram. Selecting too many classes can make diagram formation computationally expensive and may produce a diagram that is difficult to read.
Form Diagram Options
The Form Diagram Options tab controls which relationships and related model elements Visual Paradigm includes in the generated class diagram.
| Option | Description |
|---|---|
| Show superclasses | Displays generalization relationships between the selected classes and their superclasses (ancestors). |
| Show subclasses | Displays generalization relationships between the selected classes and their subclasses (descendants). |
| Show suppliers (interface) | Displays realization relationships between the selected elements and their supplier interfaces. |
| Show clients | Displays realization relationships between the selected elements and their clients, such as classes that implement them. |
| Show navigable classes | Displays association relationships between the selected classes and their navigable target classes. |
| Show non-navigable classes | Displays association relationships between the selected classes and their non-navigable source classes. |
| Show containers | Displays containment relationships between selected elements and their containers, such as packages. |
| Show residents | Displays the elements contained within the selected containers. The available depth options determine how many containment levels are included and how they are presented. |
| Show as containment relationships | Displays containment relationships as connectors in the generated diagram. Containment relationships between classes are represented using connectors. |
Show residents provides additional control over the depth and arrangement of contained elements:
- Single level only: Displays only one level of residents in the generated diagram.
- All levels in single diagram: Displays residents from all containment levels in one diagram.
- All levels in sub diagrams: Displays all containment levels using multiple diagrams, with each diagram showing a single containment level.
These options help you balance diagram completeness against readability. For a large model, using sub diagrams can make the resulting structure easier to navigate.
Presentation Options
The Presentation Options tab controls the information displayed inside the classes in the generated class diagram.
Attribute Options
Configure how class attributes are displayed:
- Show all: Displays all attributes of the classes.
- Public only: Displays only public attributes.
- Hide all: Hides all attributes.
- Initial values: Controls the display of initial values for attributes.
Operation Options
Configure how class operations are displayed:
- Show all: Displays all operations of the classes.
- Public only: Displays only public operations.
- Hide all: Hides all operations.
- Initial values: Controls the display of initial values for operations.
Type Options
Configure how attribute and operation types are represented:
- Fully-qualified: Displays fully qualified type names.
- Name only: Displays only the type name.
- Relative: Displays the type name relative to the class in which it is used.
These presentation settings affect how information is shown in the generated diagram. They provide flexibility when creating diagrams for different audiences, from detailed technical reviews to simplified architectural documentation.
Show This Window After Instant Reverse
The Instant Reverse Form Diagram window includes a Show this window after instant reverse option.
If you do not want Visual Paradigm to display the diagram formation window every time you perform Instant Reverse, uncheck this option. This is useful when you regularly reverse source code but prefer to create diagrams manually or at a later stage.
Starting or Cancelling the Operation
The Instant Reverse window provides the following actions:
- OK: Starts the reverse engineering operation using the configured language, path, update type, and destination settings.
- Cancel: Closes the Instant Reverse window without starting the operation.
- Help: Opens the corresponding help content.
How to Use Instant Code Reverse: Hibernate
Follow these steps to reverse engineer Hibernate mapping files into a UML model in Visual Paradigm Desktop.
Open Instant Reverse
- Open your project in Visual Paradigm Desktop.
- Select Tools > Code > Instant Reverse… from the toolbar.
Select Hibernate as the Language
- In the Instant Reverse window, locate the Language field.
- Select Hibernate from the language list.
Specify the Source Path
- Specify the path of the Hibernate source file or the folder containing the Hibernate mapping files.
- Check that the selected path points to the intended source material.
Choose the Destination Model
- Locate the Reverse to Model row.
- Click the … button.
- In the Select Parent Model window, select an existing model or click New Model to create one.
- Click OK to confirm.
Configure Reverse Engineering Options
Review the Update Type and Reverse to Diagram settings. Select the appropriate duplicate-class handling behavior and determine whether you want to generate a diagram as part of the reverse engineering workflow.
Start Reverse Engineering
- Review the selected language, source path, and destination model.
- Click OK to start reversing the Hibernate source.
- Wait for the reverse engineering operation to finish.
Form a Class Diagram (Optional)
- When the Instant Reverse Form Diagram window appears, select the classes that you want to include.
- Configure the relationship options under Form Diagram Options.
- Configure attributes, operations, and type presentation under Presentation Options.
- Click OK to create the class diagram.
If you do not want to create a diagram at this stage, click Cancel. The reversed classes remain available in the project and can be used to create diagrams later.
Reverse Engineer a Package Diagram from Hibernate Source
In addition to reversing UML classes, Visual Paradigm can reverse engineer a package diagram from Hibernate source files. This workflow produces UML packages and the relationships between them.
To reverse engineer a package diagram:
- Select Tools > Code > Instant Reverse… from the toolbar.
- Select Hibernate as the Language.
- Specify the path of the Hibernate source file or the folder containing the source files.
- Select Package Diagram for Reverse To.
- To specify where the reversed packages should be stored, click the … button at the end of the Reverse to Model row.
- Select an existing parent model or create a new model, then click OK.
- Click OK to start reverse engineering.
After the operation completes, the resulting UML packages and their relationships are available in the project for inspection and further modeling.
Practical Use Cases
Reconstructing a Legacy Hibernate Application
A development team inherits an application that uses Hibernate mapping files but has limited documentation. By reversing the mapping files, the team can recover model elements and use them as a starting point for documenting the existing system.
Reviewing Persistence-Related Structure
Developers can reverse Hibernate mapping files into UML model elements and inspect the resulting structure in Visual Paradigm. This helps when reviewing how the persistence-related model is represented in the existing application.
Separating Recovered and New Designs
When working on a modernization project, developers may want to keep the original system model separate from the proposed replacement design. Using Reverse to Model, they can place recovered elements in a dedicated model and maintain a clearer distinction between existing and proposed structures.
Preparing Visual Documentation
After reversing the source files, developers can select relevant classes and generate class diagrams. They can also reverse engineer package diagrams to document package organization and relationships.
Best Practices
- Use the correct source path: Make sure you select the intended Hibernate mapping file or containing folder before starting reverse engineering.
- Choose the update type carefully: Use Update duplicate class(es) when you want to update existing model elements. Use Replace duplicate class(es) when the reversed source should replace existing duplicates.
- Organize recovered elements: Use Reverse to Model to keep reversed content separate from unrelated models when appropriate.
- Start with a manageable class selection: Select only the classes needed for a diagram, particularly when working with large models.
- Configure diagram relationships deliberately: Enable only the relationship types relevant to the purpose of the diagram.
- Use sub diagrams for complex structures: When the model contains multiple levels of containment, consider using the All levels in sub diagrams option to improve readability.
- Keep diagrams audience-focused: Use attribute, operation, and type presentation settings to control the level of technical detail.
- Remember that diagram generation is optional: You can reverse the model first and create diagrams later.
Limitations and Considerations
- Input format: This workflow is intended for Hibernate source mapping files. It is not the same as reversing compiled Java classes or arbitrary source code.
- Model versus diagram: Reverse engineering creates model elements. Generating a diagram is a separate presentation step and can be skipped.
- Duplicate handling: The selected Update Type determines how duplicate classes are treated. Review this setting when reversing into a model that already contains classes.
- Diagram complexity: Selecting too many classes or enabling too many relationship types can result in large, difficult-to-read diagrams and may increase processing time.
- Source and model consistency: Reversing source files does not by itself establish an ongoing automatic synchronization process between the Hibernate source and the UML model.
Related Hibernate and ORM Capabilities
Instant Code Reverse: Hibernate is one part of Visual Paradigm Desktop’s broader Hibernate and object-relational mapping toolset. Other related capabilities include:
- Reverse engineer ORM models from Hibernate mapping files: Reconstruct ORM-related model information from Hibernate mappings.
- Reverse engineer ORM models from ORM classes: Reverse generated ORM POJO classes into a UML class model using the separate Hibernate Reverse Java Classes workflow.
- Generate ORM code: Generate persistence-related code from a class diagram.
- Generate ORM code from a database: Build an ORM tier based on an existing database.
- Synchronize class diagrams and ERDs: Keep the object model and data model aligned through the available synchronization workflows.
These capabilities serve different purposes. In particular, Tools > Code > Instant Reverse… with Hibernate selected is the workflow for reversing Hibernate source files, whereas Tools > Hibernate > Reverse Java Classes… is used to reverse ORM Java classes.
Frequently Asked Questions
What is Instant Code Reverse: Hibernate in Visual Paradigm?
It is a Visual Paradigm Desktop reverse engineering feature that reads Hibernate mapping files and converts their structural information into UML model elements. The resulting elements can be organized in a model and used to create class or package diagrams.
What files can I reverse engineer using Instant Code Reverse: Hibernate?
The feature is intended for Hibernate mapping source files. You can specify an individual source file or a folder containing the relevant files.
Where can I find Instant Code Reverse: Hibernate?
Open Visual Paradigm Desktop and select Tools > Code > Instant Reverse… from the toolbar. Then select Hibernate as the Language.
Which Visual Paradigm editions support Instant Code Reverse: Hibernate?
Hibernate reverse engineering is listed as available in Visual Paradigm Desktop Enterprise, Professional, and Standard editions. It is not listed as available in Modeler or Community editions.
Can I reverse engineer both class diagrams and package diagrams?
Yes. The Hibernate Instant Reverse workflow supports reversing UML class structures and reverse engineering package diagrams. Class diagram generation can also be performed after reversing, using the Instant Reverse Form Diagram window.
Do I have to create a class diagram immediately after reverse engineering?
No. Diagram creation is optional. If you click Cancel in the Instant Reverse Form Diagram window, the reversed classes remain in the Model Explorer or Class Repository. You can create a diagram later.
Can I choose where the reversed classes are stored?
Yes. Use the Reverse to Model option to select an existing parent model or create a new model to contain the reversed elements.
What is the difference between Update duplicate class(es) and Replace duplicate class(es)?
Update duplicate class(es) updates existing classes using information from the reversed source. Replace duplicate class(es) discards existing duplicate classes and replaces them with the reversed classes.
Do I need to select classes to create a class diagram?
Yes. You must select at least one class in the Select Class tab before Visual Paradigm can form a class diagram.
Why should I avoid selecting too many classes when forming a diagram?
Forming a diagram with too many selected classes can be computationally expensive and can make the resulting diagram difficult to understand. Select only the classes relevant to the intended view.
What does Show residents do?
Show residents controls whether the diagram includes elements contained within selected containers. You can show one containment level, all levels in one diagram, or all levels across multiple sub diagrams.
What is the difference between Show superclasses and Show subclasses?
Show superclasses includes ancestor classes and their generalization relationships. Show subclasses includes descendant classes and their generalization relationships.
What does Show suppliers (interface) mean?
It includes supplier interfaces and the realization relationships between those interfaces and the selected elements.
What is the difference between Show navigable classes and Show non-navigable classes?
Show navigable classes includes association relationships to navigable target classes. Show non-navigable classes includes association relationships to non-navigable source classes.
Can I hide attributes and operations in the generated class diagram?
Yes. In Presentation Options, select Hide all under Attribute Options or Operation Options to hide the corresponding information. You can also show all members or only public members.
Can I control how data types are displayed?
Yes. Type Options provides Fully-qualified, Name only, and Relative presentation modes.
Can I stop the diagram formation window from appearing after every reverse operation?
Yes. Uncheck Show this window after instant reverse in the Instant Reverse Form Diagram window.
Is Hibernate Instant Reverse the same as Reverse Java Classes?
No. Hibernate Instant Reverse reads Hibernate mapping source files through Tools > Code > Instant Reverse… with Hibernate selected. Reverse Java Classes is a separate workflow under Tools > Hibernate > Reverse Java Classes… for reversing ORM Java classes.
Does Instant Code Reverse automatically synchronize the UML model with Hibernate files?
No. Instant Reverse performs a reverse engineering operation using the selected source files. It does not establish continuous automatic synchronization between the source files and the UML model.
Summary
Visual Paradigm Desktop’s Instant Code Reverse: Hibernate feature helps developers recover UML model information from existing Hibernate mapping files. By selecting the source path, configuring duplicate-class handling, choosing a destination model, and optionally generating class or package diagrams, users can turn Hibernate mapping information into a visual model that is easier to inspect, organize, and document.
Whether you are maintaining a legacy application, reviewing persistence-related structures, or reconstructing missing design documentation, Hibernate reverse engineering provides a practical starting point for bringing existing implementation information back into the modeling process.
VISUAL PARADIGM