org.apache.openjpa.jdbc.meta.strats
Class MaxEmbeddedCharArrayFieldStrategy

java.lang.Object
  extended by org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
      extended by org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy
          extended by org.apache.openjpa.jdbc.meta.strats.MaxEmbeddedCharArrayFieldStrategy
All Implemented Interfaces:
Serializable, FieldStrategy, Strategy

public class MaxEmbeddedCharArrayFieldStrategy
extends AbstractFieldStrategy

Mapping for CLOB character array on a dictionary that has a maximum embedded CLOB size.

Since:
0.4.0
Author:
Abe White
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy
field
 
Constructor Summary
MaxEmbeddedCharArrayFieldStrategy()
           
 
Method Summary
 void appendIsNotNull(SQLBuffer sql, Select sel, Joins joins)
          Append a where clause to the given statement checking if this value is not null.
 void appendIsNull(SQLBuffer sql, Select sel, Joins joins)
          Append a where clause to the given statement checking if this value is null.
 void customInsert(OpenJPAStateManager sm, JDBCStore store)
          Override this method to customize flushing this mapping.
 void customUpdate(OpenJPAStateManager sm, JDBCStore store)
          Override this method to customize flushing this mapping.
 void delete(OpenJPAStateManager sm, JDBCStore store, RowManager rm)
          Set the where values appropriately to delete the proper instance, and set all relations on non-secondary tables as updates.
protected  int getExpectedJavaType()
          Return the expected type of the field from JavaTypes or JavaSQLTypes.
 void initialize()
          Perform caching and other initialization operations.
 void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm)
          Set values for the mapping into the proper rows.
protected  Boolean isCustom(OpenJPAStateManager sm, JDBCStore store)
          Return whether this is a custom insert/update.
 Boolean isCustomInsert(OpenJPAStateManager sm, JDBCStore store)
          Return Boolean.FALSE if this mapping does not customize the insert process, Boolean.TRUE if it does, or null if it does customize the insert, but also relies on the standard insert method being called.
 Boolean isCustomUpdate(OpenJPAStateManager sm, JDBCStore store)
          Return Boolean.FALSE if this mapping does not customize the update process, Boolean.TRUE if it does, or null if it does customize the update, but also relies on the standard update method being called.
 boolean isVersionable()
          Return true if this field can be used as part of a state image for optimistic locking.
 Joins join(Joins joins, boolean forceOuter)
          Join this value to the class table.
protected  Object load(Column col, Result res, Joins joins)
          Load this value from the given result.
 void load(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch)
          Load secondary data using a connection from the store manager.
 void load(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Result res)
          Load virtual row data; the given result is not guaranteed to contain data for this field, so the field mapping should make sure the result contains its needed column data before loading.
 Object loadProjection(JDBCStore store, JDBCFetchConfiguration fetch, Result res, Joins joins)
          Load this field value using the given result.
 void map(boolean adapt)
          Map the owning mapping using this strategy.
protected  void putData(OpenJPAStateManager sm, ResultSet rs, DBDictionary dict)
          Set the data from the given state manager into the result set.
 int select(Select sel, OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, int eagerMode)
          Select the virtual row columns of this mapping.
 int supportsSelect(Select sel, int type, OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch)
          Return whether this mapping can perform the given select type.
 void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm)
          Set values for the mapping into the proper rows.
protected  void update(OpenJPAStateManager sm, Row row)
          Set the value of the owning field into the given row.
 void where(OpenJPAStateManager sm, JDBCStore store, RowManager rm, Object prevValue)
          Add a WHERE condition to the row for this field such that the field's current DB value must equal the given previous value.
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy
appendIsEmpty, appendIsNotEmpty, appendSize, assertNotMappedBy, isEagerSelectToMany, joinKey, joinKeyRelation, joinRelation, loadEagerJoin, loadEagerParallel, loadKeyProjection, selectEagerJoin, selectEagerParallel, setFieldMapping, toDataStoreValue, toKeyDataStoreValue
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
customDelete, getAlias, isCustomDelete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.jdbc.meta.Strategy
customDelete, getAlias, isCustomDelete
 

Constructor Detail

MaxEmbeddedCharArrayFieldStrategy

public MaxEmbeddedCharArrayFieldStrategy()
Method Detail

getExpectedJavaType

protected int getExpectedJavaType()
Return the expected type of the field from JavaTypes or JavaSQLTypes.


update

protected void update(OpenJPAStateManager sm,
                      Row row)
               throws SQLException
Set the value of the owning field into the given row.

Throws:
SQLException

isCustom

protected Boolean isCustom(OpenJPAStateManager sm,
                           JDBCStore store)
Return whether this is a custom insert/update.


putData

protected void putData(OpenJPAStateManager sm,
                       ResultSet rs,
                       DBDictionary dict)
                throws SQLException
Set the data from the given state manager into the result set.

Throws:
SQLException

load

protected Object load(Column col,
                      Result res,
                      Joins joins)
               throws SQLException
Load this value from the given result.

Throws:
SQLException

map

public void map(boolean adapt)
Description copied from interface: Strategy
Map the owning mapping using this strategy.

Specified by:
map in interface Strategy
Parameters:
adapt - if true, use the owning mapping's raw mapping info to set its ORM data; if false, ORM data will already be set

initialize

public void initialize()
Description copied from interface: Strategy
Perform caching and other initialization operations. This method is called after Strategy.map(boolean), and after all related components have been mapped as well.

Specified by:
initialize in interface Strategy
Overrides:
initialize in class AbstractStrategy

isCustomInsert

public Boolean isCustomInsert(OpenJPAStateManager sm,
                              JDBCStore store)
Description copied from interface: Strategy
Return Boolean.FALSE if this mapping does not customize the insert process, Boolean.TRUE if it does, or null if it does customize the insert, but also relies on the standard insert method being called. Implement the Strategy.customInsert(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore) method to implement the custom insertion behavior.

Specified by:
isCustomInsert in interface Strategy
Overrides:
isCustomInsert in class AbstractStrategy

isCustomUpdate

public Boolean isCustomUpdate(OpenJPAStateManager sm,
                              JDBCStore store)
Description copied from interface: Strategy
Return Boolean.FALSE if this mapping does not customize the update process, Boolean.TRUE if it does, or null if it does customize the update, but also relies on the standard update method being called. Implement the Strategy.customUpdate(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore) method to override the default update behavior.

Specified by:
isCustomUpdate in interface Strategy
Overrides:
isCustomUpdate in class AbstractStrategy

insert

public void insert(OpenJPAStateManager sm,
                   JDBCStore store,
                   RowManager rm)
            throws SQLException
Description copied from interface: Strategy
Set values for the mapping into the proper rows. For class mappings, this method will be called only after the corresponding method has been called for all fields of this mapping.

Specified by:
insert in interface Strategy
Overrides:
insert in class AbstractStrategy
Throws:
SQLException

update

public void update(OpenJPAStateManager sm,
                   JDBCStore store,
                   RowManager rm)
            throws SQLException
Description copied from interface: Strategy
Set values for the mapping into the proper rows.

Specified by:
update in interface Strategy
Overrides:
update in class AbstractStrategy
Throws:
SQLException
See Also:
Strategy.insert(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.sql.RowManager)

delete

public void delete(OpenJPAStateManager sm,
                   JDBCStore store,
                   RowManager rm)
            throws SQLException
Description copied from interface: Strategy
Set the where values appropriately to delete the proper instance, and set all relations on non-secondary tables as updates. This allows foreign key analysis.

Specified by:
delete in interface Strategy
Overrides:
delete in class AbstractStrategy
Throws:
SQLException
See Also:
Strategy.insert(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.sql.RowManager)

customInsert

public void customInsert(OpenJPAStateManager sm,
                         JDBCStore store)
                  throws SQLException
Description copied from interface: Strategy
Override this method to customize flushing this mapping. For classes, this method must also flush all fields. For fields, this method is called after the owning object is inserted, so if this field is in a row with other fields, that row will already exist.

Specified by:
customInsert in interface Strategy
Overrides:
customInsert in class AbstractStrategy
Throws:
SQLException

customUpdate

public void customUpdate(OpenJPAStateManager sm,
                         JDBCStore store)
                  throws SQLException
Description copied from interface: Strategy
Override this method to customize flushing this mapping. For classes, this method must also flush all fields.

Specified by:
customUpdate in interface Strategy
Overrides:
customUpdate in class AbstractStrategy
Throws:
SQLException

supportsSelect

public int supportsSelect(Select sel,
                          int type,
                          OpenJPAStateManager sm,
                          JDBCStore store,
                          JDBCFetchConfiguration fetch)
Description copied from interface: FieldStrategy
Return whether this mapping can perform the given select type. Return 0 if the given type is not supported. If the given type is an eager parallel type, return the number of UNIONed selects necessary to fetch the data. Otherwise, return any positive number if the type is supported. The given state manager may be null if selecting multiple instances.

Specified by:
supportsSelect in interface FieldStrategy
Overrides:
supportsSelect in class AbstractFieldStrategy
See Also:
Select

select

public int select(Select sel,
                  OpenJPAStateManager sm,
                  JDBCStore store,
                  JDBCFetchConfiguration fetch,
                  int eagerMode)
Description copied from interface: FieldStrategy
Select the virtual row columns of this mapping.

Specified by:
select in interface FieldStrategy
Overrides:
select in class AbstractFieldStrategy
Parameters:
sel - the select to add to
sm - the instance being loaded, or null if not initialized yet or selecting for multiple instances
store - the current store manager
fetch - fetch configuration
eagerMode - the eager fetch mode to use; this may be more restrictive than the mode of the fetch configuration
Returns:
> 0 if this mapping requires the selected data (if any), 0 if it selected data but does not require it, or < 0 if no data was selected

load

public void load(OpenJPAStateManager sm,
                 JDBCStore store,
                 JDBCFetchConfiguration fetch,
                 Result res)
          throws SQLException
Description copied from interface: FieldStrategy
Load virtual row data; the given result is not guaranteed to contain data for this field, so the field mapping should make sure the result contains its needed column data before loading.

Specified by:
load in interface FieldStrategy
Overrides:
load in class AbstractFieldStrategy
Throws:
SQLException

load

public void load(OpenJPAStateManager sm,
                 JDBCStore store,
                 JDBCFetchConfiguration fetch)
          throws SQLException
Description copied from interface: FieldStrategy
Load secondary data using a connection from the store manager.

Specified by:
load in interface FieldStrategy
Overrides:
load in class AbstractFieldStrategy
Throws:
SQLException

appendIsNull

public void appendIsNull(SQLBuffer sql,
                         Select sel,
                         Joins joins)
Description copied from interface: FieldStrategy
Append a where clause to the given statement checking if this value is null.

Specified by:
appendIsNull in interface FieldStrategy
Overrides:
appendIsNull in class AbstractFieldStrategy

appendIsNotNull

public void appendIsNotNull(SQLBuffer sql,
                            Select sel,
                            Joins joins)
Description copied from interface: FieldStrategy
Append a where clause to the given statement checking if this value is not null.

Specified by:
appendIsNotNull in interface FieldStrategy
Overrides:
appendIsNotNull in class AbstractFieldStrategy

join

public Joins join(Joins joins,
                  boolean forceOuter)
Description copied from interface: FieldStrategy
Join this value to the class table. Does nothing by default.

Specified by:
join in interface FieldStrategy
Overrides:
join in class AbstractFieldStrategy

loadProjection

public Object loadProjection(JDBCStore store,
                             JDBCFetchConfiguration fetch,
                             Result res,
                             Joins joins)
                      throws SQLException
Description copied from interface: FieldStrategy
Load this field value using the given result. The result will contain the columns from ValueMapping.getColumns().

Specified by:
loadProjection in interface FieldStrategy
Overrides:
loadProjection in class AbstractFieldStrategy
Throws:
SQLException

isVersionable

public boolean isVersionable()
Description copied from interface: FieldStrategy
Return true if this field can be used as part of a state image for optimistic locking.

Specified by:
isVersionable in interface FieldStrategy
Overrides:
isVersionable in class AbstractFieldStrategy

where

public void where(OpenJPAStateManager sm,
                  JDBCStore store,
                  RowManager rm,
                  Object prevValue)
           throws SQLException
Description copied from interface: FieldStrategy
Add a WHERE condition to the row for this field such that the field's current DB value must equal the given previous value. Only versionable mappings must implement this method meaningfully.

Specified by:
where in interface FieldStrategy
Overrides:
where in class AbstractFieldStrategy
Throws:
SQLException


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.