13.3.7 Elements below mapped-superclass
The following elements and attributes apply only to the mapped superclass that is the target of the elements and attributes:
- Organization of this subsection
-
(1) <mapped-superclass>
The mapped-superclass element defines the mapped superclass of the persistence unit.
For details on the functionality and attributes, see 8.12 javax.persistence package.
The following table lists the specifiable attributes:
Attribute name |
Type |
Optional/Required |
Description |
---|---|---|---|
class |
xsd:string |
Required |
Class name of the mapped superclass. |
access |
orm:access-type |
Optional |
The access attribute defines the access type of the mapped superclass. The access attribute overwrites the access type specified in the persistence-unit-defaults element (default element) and entity-mappings element (element valid for the entire persistence unit) provided to the mapped superclass.#1 |
metadata-complete#2 |
xsd:boolean |
Optional |
If the metadata-complete attribute is specified in the mapped-superclass element, the annotations specified in the mapped superclass and in the fields and properties of the mapped superclass are ignored. If metadata-complete is specified in the mapped-superclass element and if the XML element is omitted, the default value is enabled. |
(2) <id-class>
The id-class element overwrites @IdClass specified in the mapped superclass.
For details on the functionality and attributes, see 8.12 javax.persistence package.
The following table lists the specifiable attributes:
Attribute name |
Type |
Optional/Required |
Description |
---|---|---|---|
class |
xsd:string |
Required |
See the value attribute in 8.12.22 @IdClass. |
(3) <exclude-default-listeners>
The exclude-default-listeners element is applied regardless of whether @ExcludeDefaultListeners is specified in the mapped superclass.
The exclude-default-listeners element controls the default entity listeners of the mapped superclass and the sub class.
For details on the functionality and attributes, see 8.12 javax.persistence package.
(4) <exclude-superclass-listeners>
The exclude-superclass-listeners element is applied regardless of whether @ExcludeSuperclassListeners is specified in the mapped superclass.
The exclude-superclass-listeners element controls the superclass listeners of the mapped superclass and the sub class.
For details on the functionality and attributes, see 8.12 javax.persistence package.
(5) <entity-listeners>
The entity-listeners element overwrites @EntityListeners of the mapped superclass.
If these listeners are not controlled using other methods, these listeners will be applied in the mapped superclass and the sub class.
For details on the functionality and attributes, see 8.12 javax.persistence package.
(6) <pre-persist>, <post-persist>, <pre-remove>, <post-remove>, <pre-update>, <post-update>, <post-load>
These elements overwrite the definition of the lifecycle callback method according to the corresponding annotations, in the mapped superclass.
For details on the functionality and attributes, see 8.12 javax.persistence package.
The following table lists the specifiable attributes:
Attribute name |
Type |
Optional/Required |
Description |
---|---|---|---|
method-name |
xsd:string |
Required |
Target method name. |
(7) <id>
The id element overwrites the mapping specified in fields and properties.
For details on the functionality and attributes, see 8.12 javax.persistence package.
The following table lists the specifiable attributes:
Attribute name |
Type |
Optional/Required |
Description |
---|---|---|---|
name |
xsd:string |
Required |
Specifies a primary key property or field. |
(8) <embedded-id>
The embedded-id element overwrites the mapping specified in fields and properties.
For details on the functionality and attributes, see 8.12 javax.persistence package.
The following table lists the specifiable attributes:
Attribute name |
Type |
Optional/Required |
Description |
---|---|---|---|
name |
xsd:string |
Required |
Specifies a compound primary key. |
(9) <basic>
The basic element overwrites the mapping specified in fields and properties.
For details on the functionality and attributes, see 8.12 javax.persistence package.
The following table lists the specifiable attributes:
Attribute name |
Type |
Optional/Required |
Description |
---|---|---|---|
name |
xsd:string |
Required |
Specifies the methods and fields that map the type. |
fetch |
orm:fetch-type |
Optional |
Specifies the value of the Fetch strategy. For details, see the fetch attribute in 8.12.5 @Basic. |
optional |
xsd:boolean |
Optional |
Specifies whether to use null in the field (property). For details, see the optional attribute in 8.12.5 @Basic. |
(10) <version>
The version element overwrites the mapping specified in fields and properties.
For details on the functionality and attributes, see 8.12 javax.persistence package.
The following table lists the specifiable attributes:
Attribute name |
Type |
Optional/Required |
Description |
---|---|---|---|
name |
xsd:string |
Required |
Specifies a version property or field. |
(11) <many-to-one>
The many-to-one element overwrites the mapping specified in fields and properties.
For details on the functionality and attributes, see 8.12 javax.persistence package.
The following table lists the specifiable attributes:
Attribute name |
Type |
Optional/Required |
Description |
---|---|---|---|
name |
xsd:string |
Required |
Specifies methods or fields with a many-to-one relationship. |
target-entity |
xsd:string |
Optional |
Specifies the related entity classes. For details, see the targetEntity attribute in 8.12.29 @ManyToOne. |
fetch |
orm:fetch-type |
Optional |
Specifies the value of the Fetch strategy. For details, see the fetch attribute in 8.12.29 @ManyToOne. |
optional |
xsd:boolean |
Optional |
Defines whether to specify null in all the non-primitive field and property values. For details, see the optional attribute in 8.12.29 @ManyToOne. |
(12) <one-to-many>
The one-to-many element overwrites the mapping specified in fields and properties.
For details on the functionality and attributes, see 8.12 javax.persistence package.
The following table lists the specifiable attributes:
Attribute name |
Type |
Optional/Required |
Description |
---|---|---|---|
name |
xsd:string |
Required |
Methods or fields with a one-to-many relationship. |
target-entity |
xsd:string |
Optional |
Specifies the related entity classes. For details, see the targetEntity attribute in 8.12.36 @OneToMany. |
fetch |
orm:fetch-type |
Optional |
Specifies the value of the Fetch strategy. For details, see the fetch attribute in 8.12.36 @OneToMany. |
mapped-by |
xsd:string |
Optional |
Specifies the field (property) names allocated to the elements of the owned-side entity class and the relations are maintained in the owner-side entity class. For details, see the mappedBy attribute in 8.12.36 @OneToMany. |
(13) <one-to-one>
The one-to-one element overwrites the mapping specified in fields and properties.
For details on the functionality and attributes, see 8.12 javax.persistence package.
The following table lists the specifiable attributes:
Attribute name |
Type |
Optional/Required |
Description |
---|---|---|---|
name |
xsd:string |
Required |
Methods or fields with a one-to-one relationship. |
target-entity |
xsd:string |
Optional |
See the targetEntity attribute in 8.12.37 @OneToOne. |
fetch |
orm:fetch-type |
Optional |
See the fetch attribute in 8.12.37 @OneToOne. |
optional |
xsd:boolean |
Optional |
See the optional attribute in 8.12.37 @OneToOne. |
mapped-by |
xsd:string |
Optional |
See the mappedBy attribute in 8.12.37 @OneToOne. |
(14) <many-to-many>
The many-to-many element overwrites the mapping specified in fields and properties.
For details on the functionality and attributes, see 8.12 javax.persistence package.
The following table lists the specifiable attributes:
Attribute name |
Type |
Optional/Required |
Description |
---|---|---|---|
name |
xsd:string |
Required |
Methods or fields with a many-to-many relationship. |
target-entity |
xsd:string |
Optional |
See the targetEntity attribute in 8.12.28 @ManyToMany. |
fetch |
orm:fetch-type |
Optional |
See the fetch attribute in 8.12.28 @ManyToMany. |
mapped-by |
xsd:string |
Optional |
See the mappedBy attribute in 8.12.28 @ManyToMany. |
(15) <embedded>
The embedded element overwrites the mapping specified in fields and properties.
For details on the functionality and attributes, see 8.12 javax.persistence package.
The following table lists the specifiable attributes:
Attribute name |
Type |
Optional/Required |
Description |
---|---|---|---|
name |
xsd:string |
Required |
Property or field that is an embedded object. |
(16) <transient>
The transient element overwrites the mapping specified in fields and properties.
For details on the functionality and attributes, see 8.12 javax.persistence package.
The following table lists the specifiable attributes:
Attribute name |
Type |
Optional/Required |
Description |
---|---|---|---|
name |
xsd:string |
Required |
Property or field that is non-persistent. |