Class AbstractClassStrategy
- java.lang.Object
-
- org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
-
- org.apache.openjpa.jdbc.meta.strats.AbstractClassStrategy
-
- All Implemented Interfaces:
java.io.Serializable
,ClassStrategy
,Strategy
- Direct Known Subclasses:
EmbeddedClassStrategy
,FlatClassStrategy
,FullClassStrategy
,NoneClassStrategy
,ObjectIdClassStrategy
,VerticalClassStrategy
public abstract class AbstractClassStrategy extends AbstractStrategy implements ClassStrategy
No-op strategy for easy extension.- Author:
- Abe White
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ClassMapping
cls
The owning class mapping.
-
Constructor Summary
Constructors Constructor Description AbstractClassStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResultObjectProvider
customLoad(JDBCStore store, boolean subclasses, JDBCFetchConfiguration fetch, long startIdx, long endIdx)
Implement this method to customize obtaining a result containing all instances of this class.boolean
customLoad(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Result result)
Implement this method to customize loading from aResult
into an instance.boolean
customLoad(OpenJPAStateManager sm, JDBCStore store, PCState state, JDBCFetchConfiguration fetch)
Implement this method to load the state of a given object, without a previousResult
.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
setClassMapping(ClassMapping owner)
Set the class 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 givenbase
mapping.-
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
customDelete, customInsert, customUpdate, delete, getAlias, initialize, insert, isCustomDelete, isCustomInsert, isCustomUpdate, map, update
-
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, delete, getAlias, initialize, insert, isCustomDelete, isCustomInsert, isCustomUpdate, map, update
-
-
-
-
Field Detail
-
cls
protected ClassMapping cls
The owning class mapping.
-
-
Method Detail
-
setClassMapping
public void setClassMapping(ClassMapping owner)
Description copied from interface:ClassStrategy
Set the class mapping using this strategy. This will be called before use.- Specified by:
setClassMapping
in interfaceClassStrategy
-
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 interfaceClassStrategy
- 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 interfaceClassStrategy
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 givenbase
mapping. The given state manager may be null if selecting multiple instances.- Specified by:
supportsEagerSelect
in interfaceClassStrategy
-
customLoad
public ResultObjectProvider customLoad(JDBCStore store, boolean subclasses, JDBCFetchConfiguration fetch, long startIdx, long endIdx) throws java.sql.SQLException
Description copied from interface:ClassStrategy
Implement this method to customize obtaining a result containing all instances of this class. Return null for standard loading.- Specified by:
customLoad
in interfaceClassStrategy
- Throws:
java.sql.SQLException
-
customLoad
public boolean customLoad(OpenJPAStateManager sm, JDBCStore store, PCState state, JDBCFetchConfiguration fetch) throws java.sql.SQLException, java.lang.ClassNotFoundException
Description copied from interface:ClassStrategy
Implement this method to load the state of a given object, without a previousResult
. Return true if this method handles the load. If the object does not exist in the data store, simply take no action on it (but still return true). Return false to use default loading.- Specified by:
customLoad
in interfaceClassStrategy
state
- if non-null, then you must initialize the state and persistent object of the given state manager (after determining the actual class of the object from the database, if there are possible persistent subclasses); initialization looks like this:sm.initialize (pcClass, state)
- Throws:
java.sql.SQLException
java.lang.ClassNotFoundException
-
customLoad
public boolean customLoad(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Result result) throws java.sql.SQLException
Description copied from interface:ClassStrategy
Implement this method to customize loading from aResult
into an instance. Return true if this mapping handles the load; false if normal loading should proceed after calling this method.- Specified by:
customLoad
in interfaceClassStrategy
- Throws:
java.sql.SQLException
-
-