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

java.lang.Object
  extended by org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
      extended by org.apache.openjpa.jdbc.meta.strats.AbstractClassStrategy
          extended by org.apache.openjpa.jdbc.meta.strats.VerticalClassStrategy
All Implemented Interfaces:
Serializable, ClassStrategy, Strategy

public class VerticalClassStrategy
extends AbstractClassStrategy

Mapping for subclasses that join to their superclass table.

Author:
Abe White
See Also:
Serialized Form

Field Summary
static String ALIAS
           
 
Fields inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractClassStrategy
cls
 
Constructor Summary
VerticalClassStrategy()
           
 
Method Summary
 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.
 String getAlias()
          Return the alias of this strategy.
 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.
 boolean isPrimaryKeyObjectId(boolean hasAll)
          Return true if the this class' primary key columns correspond to the base class' primary key columns used to construct oid values.
 Joins joinSuperclass(Joins joins, boolean toThis)
          Join the mapping and its superclass.
 void map(boolean adapt)
          Map the owning mapping using this strategy.
 boolean supportsEagerSelect(Select sel, OpenJPAStateManager sm, JDBCStore store, ClassMapping base, JDBCFetchConfiguration fetch)
          Return true if this strategy can perform the given select from the given base mapping.
 void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm)
          Set values for the mapping into the proper rows.
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractClassStrategy
customLoad, customLoad, customLoad, setClassMapping
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
customDelete, customInsert, customUpdate, isCustomDelete, isCustomInsert, isCustomUpdate
 
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, customInsert, customUpdate, isCustomDelete, isCustomInsert, isCustomUpdate
 

Field Detail

ALIAS

public static final String ALIAS
See Also:
Constant Field Values
Constructor Detail

VerticalClassStrategy

public VerticalClassStrategy()
Method Detail

getAlias

public String getAlias()
Description copied from interface: Strategy
Return the alias of this strategy. For custom strategies, return the full class name.

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

map

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

Specified by:
map in interface Strategy
Overrides:
map in class AbstractStrategy
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

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)

isPrimaryKeyObjectId

public boolean isPrimaryKeyObjectId(boolean hasAll)
Description copied from interface: ClassStrategy
Return true if the this class' primary key columns correspond to the base class' primary key columns used to construct oid values. Base classes always return true. Classes that join to the base class table, though, may not always join using the same columns the base class uses for oid values, or may not use all the columns. When performing a select, we will join down to the most-derived class that is identified by oid values. We cannot use non-primary key field values for joining during selects, because the field values to join on might be the ones we're trying to select! Similarly, we can only reconstruct oid values for selected objects using classes whose primary keys store oid values.

Specified by:
isPrimaryKeyObjectId in interface ClassStrategy
Overrides:
isPrimaryKeyObjectId in class AbstractClassStrategy
Parameters:
hasAll - if true, there must be a primary key column for every base class primary key column; if false the primary key must only match a subset of the base class primary key columns

joinSuperclass

public Joins joinSuperclass(Joins joins,
                            boolean toThis)
Description copied from interface: ClassStrategy
Join the mapping and its superclass.

Specified by:
joinSuperclass in interface ClassStrategy
Overrides:
joinSuperclass in class AbstractClassStrategy
toThis - if false, inner join to the superclass table; if true, outer join from the superclass table to this table

supportsEagerSelect

public boolean supportsEagerSelect(Select sel,
                                   OpenJPAStateManager sm,
                                   JDBCStore store,
                                   ClassMapping base,
                                   JDBCFetchConfiguration fetch)
Description copied from interface: ClassStrategy
Return true if this strategy can perform the given select from the given base mapping. The given state manager may be null if selecting multiple instances.

Specified by:
supportsEagerSelect in interface ClassStrategy
Overrides:
supportsEagerSelect in class AbstractClassStrategy


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