Skip to main content

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.

Jump to: navigation, search

Difference between revisions of "EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings"

 
(7 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
|toc=n
 
|toc=n
 
|eclipselink=y
 
|eclipselink=y
|eclipselinktype=JPA}}
+
|eclipselinktype=JPA
 +
|api=y
 +
|apis=
 +
* [http://www.eclipse.org/eclipselink/api/latest/javax/persistence/Basic.html @Basic]
 +
* [http://www.eclipse.org/eclipselink/api/latest/javax/persistence/Enumerated.html @Enumerated]
 +
* [http://www.eclipse.org/eclipselink/api/latest/javax/persistence/Temporal.html @Temporal]
 +
* [http://www.eclipse.org/eclipselink/api/latest/javax/persistence/Lob.html @Lob]
 +
* [http://www.eclipse.org/eclipselink/api/latest/javax/persistence/Transient.html @Transient]
 +
* [http://www.eclipse.org/eclipselink/api/latest/javax/persistence/Column.html @Column]
 +
|nativeapi=y
 +
|nativeapis=
 +
* [http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/mappings/DirectToFieldMapping.html DirectToFieldMapping]
 +
}}
  
 
=Basic Mappings=
 
=Basic Mappings=
 
Simple Java types are mapped as part of the immediate state of an entity in its fields or properties. Mappings of simple Java types are called ''basic mappings''.
 
Simple Java types are mapped as part of the immediate state of an entity in its fields or properties. Mappings of simple Java types are called ''basic mappings''.
 
For all mapping types there are a common set of options:
 
* '''Read-Only''': Specifies that the mapping should populate the value on read and copy. Required when multiple mappings share the same database column. See [[Configuring_a_Mapping_%28ELUG%29#Configuring_Read-Only_Mappings|Configuring Read-Only Mappings]] in the ''[[EclipseLink/UserGuide|EclipseLink User's Guide]]'' for details.
 
* '''Converters''' allow custom data types and data conversions to be used with most mapping types
 
** Annotations: @Converter, @TypeConverter, @ObjectTypeConverter, @StructConverter, @Convert
 
** XML: <converter>, <type-converter>, <object-type-converter>, <struct-converter>, <convert><br />See [[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Default Conversions and Converters|Default Conversions and Converters]] for details.
 
  
 
By default, EclipseLink persistence provider automatically configures a basic mapping for simple types.
 
By default, EclipseLink persistence provider automatically configures a basic mapping for simple types.
Line 23: Line 29:
 
* [[EclipseLink/UserGuide/JPA/Basic_JPA_Development/Mapping/Basic_Mappings/Transient |@Transient]]
 
* [[EclipseLink/UserGuide/JPA/Basic_JPA_Development/Mapping/Basic_Mappings/Transient |@Transient]]
 
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Column|@Column]]  
 
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Column|@Column]]  
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Default Conversions and Converters|Default Conversions and Converters]]
 
 
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Lazy Basics|Lazy Basics]]  
 
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Lazy Basics|Lazy Basics]]  
 +
 +
 +
For all mapping types there are a common set of options:
 +
* '''Read-Only''': Specifies that the mapping should populate the value on read and copy. Required when multiple mappings share the same database column.
 +
* '''Converters''': Allows custom data types and data conversions to be used with most mapping types
 +
** Annotations: <tt>@Converter</tt>, <tt>@TypeConverter</tt>, <tt>@ObjectTypeConverter</tt>, <tt>@StructConverter</tt>, <tt>@Convert</tt>
 +
** XML: <tt><converter></tt>, <tt><type-converter></tt>, <tt><object-type-converter></tt>, <tt><struct-converter></tt>, <tt><convert></tt>
 +
<br />See [[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Default Conversions and Converters|Default Conversions and Converters]] for details.
 +
  
 
{{EclipseLink_JPA
 
{{EclipseLink_JPA
|previous=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Entity/Id|@Id]]
+
|previous=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping|Configuring Mapping]]
 
|next=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Basic|@Basic]]
 
|next=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Basic|@Basic]]
|up=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping|Mapping]]
+
|up=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping|Configuring Mapping]]
 
|version=2.2.0 DRAFT}}
 
|version=2.2.0 DRAFT}}

Latest revision as of 11:31, 27 October 2011

EclipseLink JPA


Basic Mappings

Simple Java types are mapped as part of the immediate state of an entity in its fields or properties. Mappings of simple Java types are called basic mappings.

By default, EclipseLink persistence provider automatically configures a basic mapping for simple types.

Use the following annotations to fine-tune how your database implements these mappings:


For all mapping types there are a common set of options:

  • Read-Only: Specifies that the mapping should populate the value on read and copy. Required when multiple mappings share the same database column.
  • Converters: Allows custom data types and data conversions to be used with most mapping types
    • Annotations: @Converter, @TypeConverter, @ObjectTypeConverter, @StructConverter, @Convert
    • XML: <converter>, <type-converter>, <object-type-converter>, <struct-converter>, <convert>


See Default Conversions and Converters for details.


Eclipselink-logo.gif
Version: 2.2.0 DRAFT
Other versions...

Back to the top