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 "Customizing the EclipseLink Application (ELUG)"

m (New page: <div style="margin:5px;float:right;border:1px solid #000000;padding:5px">__TOC__ Related Topics</div> There are mul...)
 
m
Line 4: Line 4:
  
  
==Introduction to Customization==
+
<span id="Introduction to Customization"></span>By design, EclipseLink can adapt to a variety of relational and nonrelational data sources.
By design, EclipseLink can adapt to a variety of relational and nonrelational data sources.
+
  
To integrate EclipseLink with a data source that is not directly supported by the EclipseLink API,we recommend that you use an EIS project (see [[Introduction%20to%20EIS%20Projects%20(ELUG)|Introduction to EIS Projects]]) or a XML project (see [[Introduction%20to%20XML%20Projects%20(ELUG)|Introduction to XML Projects]]).
+
To integrate EclipseLink with a data source that is not directly supported by the EclipseLink API,we recommend that you use an [[Introduction%20to%20EIS%20Projects%20(ELUG)|EIS project]] or a [[Introduction%20to%20XML%20Projects%20(ELUG)|XML project ]]).
  
 
Using an EIS project, you can integrate your EclipseLink-enabled application with any nonrelational data source that supports a JCA adapter and any supported EIS record type, including indexed, mapped, or XML. If no JCA adapter exists for your target data source, you can concentrate your integration efforts on creating an adapter. Simultaneously, you can build your application according to JCA specifications. Although this still requires custom development effort, it is more efficient than trying to extend EclipseLink classes and provides you with a JCA adapter that you can leverage in any other project (making it a better value).
 
Using an EIS project, you can integrate your EclipseLink-enabled application with any nonrelational data source that supports a JCA adapter and any supported EIS record type, including indexed, mapped, or XML. If no JCA adapter exists for your target data source, you can concentrate your integration efforts on creating an adapter. Simultaneously, you can build your application according to JCA specifications. Although this still requires custom development effort, it is more efficient than trying to extend EclipseLink classes and provides you with a JCA adapter that you can leverage in any other project (making it a better value).
Line 20: Line 19:
 
EclipseLink provides support for all the most common Java data types. This table lists the EclipseLink mapping extensions that you can use to support custom data types. You can also create your object converter to allow conversion between a data type and your own Java type.
 
EclipseLink provides support for all the most common Java data types. This table lists the EclipseLink mapping extensions that you can use to support custom data types. You can also create your object converter to allow conversion between a data type and your own Java type.
  
 
+
<span id="Table 15-1"></span>
 
+
''''' Mapping Extensions for Custom Data Types'''''
'''''Table 15-1 Mapping Extensions for Custom Data Types'''''
+
  
 
{| class="HRuleFormalMax" dir="ltr" title="Mapping Extensions for Custom Data Types" summary="This table lists the mapping extensions that you can use to support custom data types." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
 
{| class="HRuleFormalMax" dir="ltr" title="Mapping Extensions for Custom Data Types" summary="This table lists the mapping extensions that you can use to support custom data types." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
Line 30: Line 28:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r2c1-t2" headers="r1c1-t2" align="left" |
 
| id="r2c1-t2" headers="r1c1-t2" align="left" |
Object type converter (see [[Introduction%20to%20Mappings%20(ELUG)|Object Type Converter]])
+
[[Introduction%20to%20Mappings%20(ELUG)|Object Type Converter]]
 
| headers="r2c1-t2 r1c2-t2" align="left" |
 
| headers="r2c1-t2 r1c2-t2" align="left" |
 
An extension of direct and direct collection mappings that lets you match a fixed number of data values to Java objects. Use this converter when the values in the schema differ from those in Java
 
An extension of direct and direct collection mappings that lets you match a fixed number of data values to Java objects. Use this converter when the values in the schema differ from those in Java
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r3c1-t2" headers="r1c1-t2" align="left" |
 
| id="r3c1-t2" headers="r1c1-t2" align="left" |
Serialized object converter (see [[Introduction%20to%20Mappings%20(ELUG)|Serialized Object Converter]])
+
[[Introduction%20to%20Mappings%20(ELUG)|Serialized Object Converter]]
 
| headers="r3c1-t2 r1c2-t2" align="left" |
 
| headers="r3c1-t2 r1c2-t2" align="left" |
 
An extension of direct and direct collection mappings that lets you map serializable objects, such as multimedia data, to a binary format in a data source, such as a base64 element in an XML document or Binary Large Object (BLOB) field in a database
 
An extension of direct and direct collection mappings that lets you map serializable objects, such as multimedia data, to a binary format in a data source, such as a base64 element in an XML document or Binary Large Object (BLOB) field in a database
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r4c1-t2" headers="r1c1-t2" align="left" |
 
| id="r4c1-t2" headers="r1c1-t2" align="left" |
Type conversion converter (see [[Introduction%20to%20Mappings%20(ELUG)|Type Conversion Converter]])
+
[[Introduction%20to%20Mappings%20(ELUG)|Type Conversion Converter]]
 
| headers="r4c1-t2 r1c2-t2" align="left" |
 
| headers="r4c1-t2 r1c2-t2" align="left" |
An extension of direct and direct collection mappings that lets you explicitly map a data source type to a Java type. For example, a <code>java.util.Date</code> in Java can be mapped to a <code>java.sql.Date</code> in the data source.
+
An extension of direct and direct collection mappings that lets you explicitly map a data source type to a Java type. For example, a <tt>java.util.Date</tt> in Java can be mapped to a <tt>java.sql.Date</tt> in the data source.
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r5c1-t2" headers="r1c1-t2" align="left" |
 
| id="r5c1-t2" headers="r1c1-t2" align="left" |
Simple type translator (see [[Introduction%20to%20Mappings%20(ELUG)|Simple Type Translator]])
+
[[Introduction%20to%20Mappings%20(ELUG)|Simple Type Translator]]
 
| headers="r5c1-t2 r1c2-t2" align="left" |
 
| headers="r5c1-t2 r1c2-t2" align="left" |
An extension of direct and direct collection mappings that lets you automatically translate an XML element value to an appropriate Java type based on the element's <code><type></code> attribute as defined in your XML schema.
+
An extension of direct and direct collection mappings that lets you automatically translate an XML element value to an appropriate Java type based on the element's <tt><type></tt> attribute as defined in your XML schema.
 
|}
 
|}
  
<br />
+
 
 +
 
  
 
==Using the Session Customizer Class==
 
==Using the Session Customizer Class==
You can customize a session at run time by specifying a session customizer–a Java class that implements the <code>org.eclipse.persistence.sessionconfiguration.SessionCustomizer</code> interface.
+
You can customize a session at run time by specifying a session customizer–a Java class that implements the <tt>org.eclipse.persistence.sessionconfiguration.SessionCustomizer</tt> interface.
  
 
For more information, see the following:
 
For more information, see the following:
* [[Introduction%20to%20EclipseLink%20Sessions%20(ELUG)|Session Customization]]
+
* [[Introduction%20to%20EclipseLink%20Sessions%20(ELUG)#Session Customization|Session Customization]]
* [[Configuring%20a%20Session%20(ELUG)|Configuring a Session Customizer Class]]
+
* [[Configuring%20a%20Session%20(ELUG)#Configuring a Session Customizer Class|Configuring a Session Customizer Class]]
* Persistence unit property <code>eclipselink.session.customizer</code> in [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)|EclipseLink JPA Persistence Unit Properties for Customization and Validation]]
+
* Persistence unit property <tt>eclipselink.session.customizer</tt> in [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)#EclipseLink JPA Persistence Unit Properties for Customization and Validation|EclipseLink JPA Persistence Unit Properties for Customization and Validation]]
  
  
  
 
==Using the Descriptor Customizer Class==
 
==Using the Descriptor Customizer Class==
You can customize a descriptor at run time by specifying a descriptor customizer–a Java class that implements the <code>org.eclipse.persistence.tools.sessionconfiguration.DescriptorCustomizer</code> interface.
+
You can customize a descriptor at run time by specifying a descriptor customizer–a Java class that implements the <tt>org.eclipse.persistence.tools.sessionconfiguration.DescriptorCustomizer</tt> interface.
  
 
For more information, see the following:
 
For more information, see the following:
* [[Introduction%20to%20Descriptors%20(ELUG)|Descriptor Customization]]
+
* [[Introduction%20to%20Descriptors%20(ELUG)#Descriptor Customization|Descriptor Customization]]
* [[Configuring%20a%20Descriptor%20(ELUG)|Configuring a Descriptor Customizer Class]]
+
* [[Configuring%20a%20Descriptor%20(ELUG)#Configuring a Descriptor Customizer Class|Configuring a Descriptor Customizer Class]]
 
* [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)|How to Use the @Customizer Annotation]]
 
* [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)|How to Use the @Customizer Annotation]]
* Persistence unit property <code>eclipselink.descriptor.customizer.<ENTITY></code> in [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)|EclipseLink JPA Persistence Unit Properties for Customization and Validation]]
+
* Persistence unit property <tt>eclipselink.descriptor.customizer.<ENTITY></tt> in [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)#EclipseLink JPA Persistence Unit Properties for Customization and Validation|EclipseLink JPA Persistence Unit Properties for Customization and Validation]]
  
  
Line 77: Line 76:
  
 
For more information, see the following:
 
For more information, see the following:
* [[Introduction%20to%20Descriptors%20(ELUG)|Amendment and After-Load Methods]]
+
* [[Introduction%20to%20Descriptors%20(ELUG)#Amendment and After-Load Methods|Amendment and After-Load Methods]]
* [[Configuring%20a%20Descriptor%20(ELUG)|Configuring Amendment Methods]]
+
* [[Configuring%20a%20Descriptor%20(ELUG)#Configuring Amendment Methods|Configuring Amendment Methods]]
  
  
Line 96: Line 95:
 
[[Category: Draft]]
 
[[Category: Draft]]
 
[[Category: Concept]]
 
[[Category: Concept]]
 +
[[Category: Task]]

Revision as of 11:43, 5 December 2007

There are multiple ways to customize your EclipseLink application, ranging from creating custom data types to using JPA extensions.


By design, EclipseLink can adapt to a variety of relational and nonrelational data sources.

To integrate EclipseLink with a data source that is not directly supported by the EclipseLink API,we recommend that you use an EIS project or a XML project ).

Using an EIS project, you can integrate your EclipseLink-enabled application with any nonrelational data source that supports a JCA adapter and any supported EIS record type, including indexed, mapped, or XML. If no JCA adapter exists for your target data source, you can concentrate your integration efforts on creating an adapter. Simultaneously, you can build your application according to JCA specifications. Although this still requires custom development effort, it is more efficient than trying to extend EclipseLink classes and provides you with a JCA adapter that you can leverage in any other project (making it a better value).

Using an XML project, you can integrate your EclipseLink-enabled application with Web services or other XML-message based designs.

The remainder of this chapter describes other customization options provided by the EclipseLink API.


Creating Custom Data Types

EclipseLink provides support for all the most common Java data types. This table lists the EclipseLink mapping extensions that you can use to support custom data types. You can also create your object converter to allow conversion between a data type and your own Java type.

Mapping Extensions for Custom Data Types

Extension Description

Object Type Converter

An extension of direct and direct collection mappings that lets you match a fixed number of data values to Java objects. Use this converter when the values in the schema differ from those in Java

Serialized Object Converter

An extension of direct and direct collection mappings that lets you map serializable objects, such as multimedia data, to a binary format in a data source, such as a base64 element in an XML document or Binary Large Object (BLOB) field in a database

Type Conversion Converter

An extension of direct and direct collection mappings that lets you explicitly map a data source type to a Java type. For example, a java.util.Date in Java can be mapped to a java.sql.Date in the data source.

Simple Type Translator

An extension of direct and direct collection mappings that lets you automatically translate an XML element value to an appropriate Java type based on the element's <type> attribute as defined in your XML schema.



Using the Session Customizer Class

You can customize a session at run time by specifying a session customizer–a Java class that implements the org.eclipse.persistence.sessionconfiguration.SessionCustomizer interface.

For more information, see the following:


Using the Descriptor Customizer Class

You can customize a descriptor at run time by specifying a descriptor customizer–a Java class that implements the org.eclipse.persistence.tools.sessionconfiguration.DescriptorCustomizer interface.

For more information, see the following:


Using the Descriptor Amendment Methods

To customize descriptors, you can use their amendment methods.

For more information, see the following:


Using EclipseLink JPA Extensions

If you are developing a EclipseLink JPA application, use EclipseLink JPA metadata annotations and XML extensions for customization.

For more information, see Using EclipseLink JPA Extensions.



Copyright Statement

Back to the top