POJO
From JRapid
POJO stands for Plain Old Java Object. Every entity defined in a JRapid project generates a POJO or model classes.
Actually, two classes are generated for each entity.
- <EntityName>
- This class is empty when created and is never overwritten by the code generation process. It extends the <EntityName>Abstract class. Custom code should be added here.
- <EntityName>Abstract
- This class contains the actual code for the POJO. The getter and setter methods for the properties defined in the entity. It implements the Entity interface that is part of the jrapid-ntier library. See Entity Abstract for more details.
Example
For example, let's take the simple Company entity defined as follows.
<entity label="Company" menu="Menu" name="Company">
<property display="primary" label="Name" name="name"/>
<property label="Address" name="address" type="text"/>
</entity>
This generates two classes in the 'entities' subpackage of the default package. As said, POJOs are created in two layers, allowing for code customization.
- Company
- Empty when created and never overwritten by the code generation process. It extends the CompanyAbstract class. Add your custom code here.
- CompanyAbstract
- Getter and setter methods for the properties defined in the Company entity are implemented here. It implements the Entity interface that is part of the jrapid-ntier library.
If no property is defined as a primary key, JRapid generates an id property of type long. This property is not shown in the entity form.
