Annotation Type SerializedObject


@Target(TYPE) @Retention(RUNTIME) public @interface SerializedObject
SerializedObject annotation is used to set an org.eclipse.persistence.descriptors.SerializedObjectPolicy on an Entity or MappedSuperClass. If SerializedObjectPolicy is specified Eclipselink writes out the whole entity object with its privately owned (and nested privately owned) entities and element collections into an additional (likely BLOB) field in the database. That field could be specified in the annotation, it defaults to "SOP" in the main table.

Examples:


 @Entity
 @SerializedObject(MySerializedObjectPolicy.class);
 public class Employee {...
 

 @Entity
 @SerializedObject(value = MySerializedObjectPolicy.class, column = @Column(name="SERIALIZED"));
 public class Address {...
 
If SerializedObjectPolicy is set on an entity then SerializedObjectPolicies with the same field are set on all inheriting entities. The query that uses SerializedObjectPolicy extracts the whole object from that field. To read object(s) using SerializedObjectPolicy the query should specify
Since:
EclipseLink 2.5.1
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The Class that implements org.eclipse.persistence.descriptors.SerializedObjectPolicy interface.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    (Optional) The column that holds the serialized object.
  • Element Details

    • value

      Class<?> value
      The Class that implements org.eclipse.persistence.descriptors.SerializedObjectPolicy interface. This class must be specified.
    • column

      Column column
      (Optional) The column that holds the serialized object. By default it's a BLOB column named "SOP" in entity's main table.
      Default:
      @jakarta.persistence.Column(name="SOP")