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

From Eclipsepedia

Jump to: navigation, search
m
m
Line 2: Line 2:
 
|info=y
 
|info=y
 
|toc=n
 
|toc=n
 
+
|eclipselink=y
 +
|eclipselinktype=JPA
 
|api=y
 
|api=y
 
|apis=
 
|apis=
Line 19: Line 20:
 
You can also use the <tt>@Column</tt> attribute <tt>columnDefinition</tt> to further refine the <tt>Lob</tt> type.
 
You can also use the <tt>@Column</tt> attribute <tt>columnDefinition</tt> to further refine the <tt>Lob</tt> type.
 
{{EclipseLink_Spec
 
{{EclipseLink_Spec
|section=Section 9.1.5 "Column Annotation"}}
+
|section=Section 11.1.9 "Column Annotation"}}
  
 
The <tt>@Lob</tt> annotation does not have attributes.
 
The <tt>@Lob</tt> annotation does not have attributes.
Line 39: Line 40:
  
 
{{EclipseLink_Spec
 
{{EclipseLink_Spec
|section=Section 9.1.20 "Temporal Annotation"}}
+
|section=Section 11.1.24 "Lob Annotation"}}
 +
 
  
  

Revision as of 11:39, 2 May 2011

EclipseLink JPA

link="http://wiki.eclipse.org/EclipseLink"
EclipseLink
Website
Download
Community
Mailing ListForumsIRC
Bugzilla
Open
Help Wanted
Bug Day
Contribute
Browse Source

Elug api package icon.png Key API


@Lob

By default, the 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 11.1.9 "Column Annotation" in the JPA Specification.

The @Lob annotation does not have attributes.

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

Example: @Lob
 @Entity
 public class Employee implements Serializable {
     ...
     @Lob
     @Basic(fetch=LAZY)
     @Column(name="EMP_PIC", columnDefinition="BLOB NOT NULL")
     protected byte[] pic;
     ...
 }
Elug javaspec icon.gif

For more information, see Section 11.1.24 "Lob Annotation" in the JPA Specification.



Eclipselink-logo.gif
Version: 2.1.0
Other versions...