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

From Eclipsepedia

Jump to: navigation, search
Line 38: Line 38:
|previous=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Temporal|Temporal]]
|previous=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Temporal|@Temporal]]
|next=    [[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Transient|Transient]]
|next=    [[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Transient|@Transient]]
|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.1.0}}
|version= 2.1.0}}

Revision as of 11:07, 10 February 2011

Mailing ListForumsIRC
Help Wanted
Bug Day
Browse Source


By default, EclipseLink persistence provider assumes that all persistent data can be represented as typical database data types.

Use the @Lob annotation with the @Basic mapping to specify that a persistent property or field should be persisted as a large object to a database-supported large object type.

A Lob may be either a binary or character type. The persistence provider infers the Lob type from the type of the persistent field or property.

For String and character-based types, the default is Clob. In all other cases, the default is Blob.

You can also use the @Column attribute columnDefinition to further refine the Lob type.

Elug javaspec icon.gif

For more information, see Section 9.1.5 "Column Annotation" in the JPA Specification.

The @Lob annotation does not have attributes.

This example shows how to use this @Lob annotation to specify that persistent field pic should be persisted as a Blob.

Usage of the @Lob Annotation

 public class Employee implements Serializable {
     @Column(name="EMP_PIC", columnDefinition="BLOB NOT NULL")
     protected byte[] pic;
Elug javaspec icon.gif

For more information, see Section 9.1.20 "Temporal Annotation" in the JPA Specification.

Version: 2.1.0
Other versions...