Stereotype | Role
|
Applicable Elements | Property
|
Tagged Values |
Name | Type | Description |
linkTable
| String
| In object relational mapping a so called link table is required when m:n associations should be mapped to a database. This attribute can be used to define the name of the link table. |
cascade
| CascadeType
| Attribute cascade can be used to define what should happen with the object on the applied association end when the other objects is saved, updated or deleted. It is possible to define more than one cascade type. The following cascade types can be used: NONE , SAVE-UPDATE , PERSIST , MERGE , DELETE , REMOVE , LOCK , REPLICATE , EVICT , REFRESH , ALL and DELETE_ORPHAN As JEAF uses Java Persistence API (JPA) for persistence the concrete details about the cascade types can be taken from their documentation. Default value is NONE . |
inverse
| boolean
| The optional attribute inverse will also be considered by persistence frameworks. In case of a bidirectional association both ends will be mapped to the database. When the persistence framework updates an object it will also updated all referenced objects. This means in case that object A has an bidirectional association to object B then object B will be updated when A is updated. In case of a bidirectional association also B has an reference to A. This leads to the situation that in our case object A will be updated 2 times which would also lead to 2 SQL statements. This can be avoided by setting inverse = true on one side of the association. This way one side becomes the master and the other one the slave. By default the attribute is set to false . |
notLazy
| boolean
| By default persistence frameworks only load referenced objects from the database when they are accessed (lazy loading). In general this behavior is fine, but there are cases where this behavior is unsuitable. By setting attribute notLazy = true it’s possible to tell persistence frameworks that lazy load should not be used for an association end. Default value is false . |
foreignKeyOwner
| boolean
| In case of 1:1 relations between classes in object relational mapping it is not clear on which side a foreign key should be stored. In this case attribute foreignKeyOwner has to be set on one end of an association. As the attribute is only relevant for 1:1 associations it default value is false . |
foreignKeyName
| String
| Attribute foreignKeyName can be used to define the name of the foreign key row on the database. If the attribute is not set then the name is derived from the role name of the association end. Attention: The foreign key name has to be defined on the association end with multiplicity 0..1 or 1 . the attribute can not be used in case of m:n relations. |
fetchType
| FetchType
| Attribute fetchType defines the way how persistence frameworks deal with loading of references of this associations. Depending on the concrete scenarios of your application you should choose the best matching fetch type. The following options are available: SELECT means that the association will be loaded lazy (on access only). Persistence frameworks therefore will send an additional SQL statements to the database to load all referenced objects. If you are using this option then we strongly recommend to also make use of attribute batchSize . Otherwise you will run into the so called n+1 problem, which will end up in way too many SQL statements and poor performance due to that.
JOIN means that associated objects will already be loaded when the object holding the association is loaded. This is also called eager loading. Persistence framework will be able to do so with only 1 SQL statement but you will load way more data into memory which might not be needed.
NONE means that the fetch type will not be set in the persistence mapping. In this case the default behavior of the persistence framework will be used. We strongly recommend to only use this setting in early development stages
|
batchSize
| Integer
| Attribute batchSize defines the amount of objects that are read at once when using batch fetching. Batch fetching can only be used on association ends with multiplicity 0..* or 1..* . Batch fetching is enabled by defining a batch size. Further details about batch fetching can be taken from JPA documentation. |
onlyInternalGetter
| boolean
| Attribute onlyInternalGetter is intended to control visibility of get method of attribute but is currently not supported by JEAF Generator. |
onlyInternalSetter
| boolean
| Attribute onlyInternalSetter is intended to control visibility of set method of attribute but is currently not supported by JEAF Generator. |