Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Default Conversions and Converters"
< EclipseLink | UserGuide | JPA | Basic JPA Development | Mapping | Basic Mappings
m |
m |
||
(3 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
|apis= | |apis= | ||
* [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/annotations/Converter.html @Converter] | * [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/annotations/Converter.html @Converter] | ||
− | * [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/annotations/TypeConverter.html TypeConverter] | + | * [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/annotations/TypeConverter.html @TypeConverter] |
+ | * [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/annotations/ObjectTypeConverter.html @ObjectTypeConverter] | ||
+ | * [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/annotations/StructConverter.html @StructConverter] | ||
+ | * [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/annotations/Convert.html @Convert] | ||
}} | }} | ||
Line 18: | Line 21: | ||
# <tt>[[EclipseLink/UserGuide/JPA/Basic_JPA_Development/Mapping/Basic_Mappings/Default_Conversions_and_Converters/Convert|@Convert]]</tt> | # <tt>[[EclipseLink/UserGuide/JPA/Basic_JPA_Development/Mapping/Basic_Mappings/Default_Conversions_and_Converters/Convert|@Convert]]</tt> | ||
− | # <tt> | + | # <tt>@Enumerated|@Enumerated</tt> |
− | # <tt> | + | # <tt>@Lob</tt> |
− | # <tt> | + | # <tt>@Temporal</tt> |
# Serialized (automatic) | # Serialized (automatic) | ||
You can define converters at the class, field and property level. You can specify EclipseLink converters on the following classes: | You can define converters at the class, field and property level. You can specify EclipseLink converters on the following classes: | ||
− | * <tt>@Entity</tt> | + | * <tt>@Entity</tt> |
− | * <tt> | + | * <tt>@MappedSuperclass</tt> |
− | * <tt> | + | * <tt>@Embeddable</tt> |
You can use EclipseLink converters with the following mappings: | You can use EclipseLink converters with the following mappings: | ||
− | * <tt> | + | * <tt>@Basic</tt> |
− | * <tt> | + | * <tt>@Id</tt> |
− | * <tt> | + | * <tt>@Version</tt> |
− | * <tt> | + | * <tt>@BasicMap</tt> |
− | * <tt> | + | * <tt>@BasicCollection</tt> |
If you specify a converter with any other type of mapping annotation, EclipseLink will throw an exception. | If you specify a converter with any other type of mapping annotation, EclipseLink will throw an exception. | ||
Line 44: | Line 47: | ||
|next=[[EclipseLink/UserGuide/JPA/Basic_JPA_Development/Mapping/Basic_Mappings/Default_Conversions_and_Converters/Converter|@Converter]] | |next=[[EclipseLink/UserGuide/JPA/Basic_JPA_Development/Mapping/Basic_Mappings/Default_Conversions_and_Converters/Converter|@Converter]] | ||
|up=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings|Basic Mappings]] | |up=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings|Basic Mappings]] | ||
− | |version=2. | + | |version=2.2.0 DRAFT |
}} | }} |
Latest revision as of 10:02, 5 May 2011
EclipseLink | |
Website | |
Download | |
Community | |
Mailing List • Forums • IRC • mattermost | |
Issues | |
Open • Help Wanted • Bug Day | |
Contribute | |
Browse Source |
Default Conversions and Converters
EclipseLink defines the following converter annotations and XML attributes (in addition to JPA-defined ones):
EclipseLink persistence provider searches the converter annotations in the following order:
- @Convert
- @Enumerated|@Enumerated
- @Lob
- @Temporal
- Serialized (automatic)
You can define converters at the class, field and property level. You can specify EclipseLink converters on the following classes:
- @Entity
- @MappedSuperclass
- @Embeddable
You can use EclipseLink converters with the following mappings:
- @Basic
- @Id
- @Version
- @BasicMap
- @BasicCollection
If you specify a converter with any other type of mapping annotation, EclipseLink will throw an exception.