public class Discriminator extends Object implements DiscriminatorStrategy, MetaDataContext, MetaDataModes
Modifier and Type | Field and Description |
---|---|
static Object |
NULL
Null discriminator value marker.
|
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY
Constructor and Description |
---|
Discriminator(ClassMapping mapping)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addClassConditions(Select sel,
boolean subs,
Joins joins)
Add WHERE conditions to the given select limiting the returned results
to our mapping type, possibly including subclasses.
|
void |
clearMapping()
Clear mapping information, including strategy.
|
void |
customDelete(OpenJPAStateManager sm,
JDBCStore store)
Override this method to customize flushing this mapping.
|
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.
|
String |
getAlias()
Return the alias of this strategy.
|
Class<?> |
getClass(JDBCStore store,
ClassMapping base,
Result result)
Return the class for the current result row.
|
SQLBuffer |
getClassConditions(Select sel,
Joins joins,
ClassMapping base,
boolean subs)
Return SQL to limit the classes selected as much as possible to the
given base class, and optionally its subclasses.
|
ClassMapping |
getClassMapping()
Return the owning mapping.
|
ColumnIO |
getColumnIO()
I/O information on the discriminator columns.
|
Column[] |
getColumns()
Columns used by this Discriminator.
|
Index |
getIndex()
Index on the Discriminator columns, or null if none.
|
int |
getJavaType() |
DiscriminatorMappingInfo |
getMappingInfo()
Raw mapping data.
|
MappingRepository |
getMappingRepository() |
MetaDataRepository |
getRepository()
Access metadata repository.
|
int |
getResolve()
Resolve mode.
|
DiscriminatorStrategy |
getStrategy()
The strategy used for class discrimination.
|
boolean |
getSubclassesLoaded()
Whether this Discriminator has loaded subclasses yet.
|
Object |
getValue()
The discriminator value.
|
boolean |
hasClassConditions(ClassMapping base,
boolean subs)
Whether any class conditions are necessary.
|
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 |
isCustomDelete(OpenJPAStateManager sm,
JDBCStore store)
Return
Boolean.FALSE if this mapping does not customize the
delete process, Boolean.TRUE if it does, or null if it does
customize the delete, but also relies on the standard delete method
being called. |
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. |
void |
loadSubclasses(JDBCStore store)
Load all subclasses of the owning class mapping into the JVM.
|
void |
map(boolean adapt)
Map the owning mapping using this strategy.
|
void |
refSchemaComponents()
Increment the reference count of used schema components.
|
boolean |
resolve(int mode)
Resolve mapping information.
|
boolean |
select(Select sel,
ClassMapping mapping)
Select the data for this Discriminator.
|
void |
setColumnIO(ColumnIO io)
I/O information on the discriminator columns.
|
void |
setColumns(Column[] cols)
Columns used by this Discriminator.
|
void |
setDiscriminator(Discriminator owner)
Set the Discriminator that uses this strategy.
|
void |
setIndex(Index idx)
Index on the Discriminator columns, or null if none.
|
void |
setJavaType(int javaType) |
void |
setResolve(int mode)
Resolve mode.
|
void |
setResolve(int mode,
boolean on)
Resolve mode.
|
void |
setStrategy(DiscriminatorStrategy strategy,
Boolean adapt)
The strategy used for class discrimination.
|
void |
setSubclassesLoaded(boolean loaded)
Whether this Discriminator has loaded subclasses yet.
|
void |
setValue(Object value)
The discriminator value.
|
void |
syncMappingInfo()
Update
MappingInfo with our current mapping information. |
String |
toString() |
void |
update(OpenJPAStateManager sm,
JDBCStore store,
RowManager rm)
Set values for the mapping into the proper rows.
|
public static final Object NULL
public Discriminator(ClassMapping mapping)
public MetaDataRepository getRepository()
MetaDataContext
getRepository
in interface MetaDataContext
public MappingRepository getMappingRepository()
public ClassMapping getClassMapping()
public DiscriminatorStrategy getStrategy()
public void setStrategy(DiscriminatorStrategy strategy, Boolean adapt)
adapt
parameter determines whether to adapt when mapping the strategy;
use null if the strategy should not be mapped.public Object getValue()
public void setValue(Object value)
public DiscriminatorMappingInfo getMappingInfo()
public Column[] getColumns()
public void setColumns(Column[] cols)
public ColumnIO getColumnIO()
public void setColumnIO(ColumnIO io)
public Index getIndex()
public void setIndex(Index idx)
public void refSchemaComponents()
public void clearMapping()
public void syncMappingInfo()
MappingInfo
with our current mapping information.public int getResolve()
public void setResolve(int mode)
public void setResolve(int mode, boolean on)
public boolean resolve(int mode)
public boolean getSubclassesLoaded()
public void setSubclassesLoaded(boolean loaded)
public boolean addClassConditions(Select sel, boolean subs, Joins joins)
public String getAlias()
Strategy
public void map(boolean adapt)
Strategy
public void initialize()
Strategy
Strategy.map(boolean)
, and after all related components have been
mapped as well.initialize
in interface Strategy
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException
Strategy
insert
in interface Strategy
SQLException
public void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException
Strategy
update
in interface Strategy
SQLException
Strategy.insert(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.sql.RowManager)
public void delete(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException
Strategy
delete
in interface Strategy
SQLException
Strategy.insert(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.sql.RowManager)
public Boolean isCustomInsert(OpenJPAStateManager sm, JDBCStore store)
Strategy
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.isCustomInsert
in interface Strategy
public Boolean isCustomUpdate(OpenJPAStateManager sm, JDBCStore store)
Strategy
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.isCustomUpdate
in interface Strategy
public Boolean isCustomDelete(OpenJPAStateManager sm, JDBCStore store)
Strategy
Boolean.FALSE
if this mapping does not customize the
delete process, Boolean.TRUE
if it does, or null if it does
customize the delete, but also relies on the standard delete method
being called. Implement the Strategy.customDelete(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore)
method
to override the default deletion behavior.isCustomDelete
in interface Strategy
public void customInsert(OpenJPAStateManager sm, JDBCStore store) throws SQLException
Strategy
customInsert
in interface Strategy
SQLException
public void customUpdate(OpenJPAStateManager sm, JDBCStore store) throws SQLException
Strategy
customUpdate
in interface Strategy
SQLException
public void customDelete(OpenJPAStateManager sm, JDBCStore store) throws SQLException
Strategy
customDelete
in interface Strategy
SQLException
public void setDiscriminator(Discriminator owner)
DiscriminatorStrategy
setDiscriminator
in interface DiscriminatorStrategy
public boolean select(Select sel, ClassMapping mapping)
DiscriminatorStrategy
select
in interface DiscriminatorStrategy
mapping
- the known base class being selected; this may
not be the base class in the inheritance hierarchypublic void loadSubclasses(JDBCStore store) throws SQLException, ClassNotFoundException
DiscriminatorStrategy
loadSubclasses
in interface DiscriminatorStrategy
SQLException
ClassNotFoundException
public Class<?> getClass(JDBCStore store, ClassMapping base, Result result) throws SQLException, ClassNotFoundException
DiscriminatorStrategy
getClass
in interface DiscriminatorStrategy
SQLException
ClassNotFoundException
public boolean hasClassConditions(ClassMapping base, boolean subs)
DiscriminatorStrategy
public SQLBuffer getClassConditions(Select sel, Joins joins, ClassMapping base, boolean subs)
DiscriminatorStrategy
getClassConditions
in interface DiscriminatorStrategy
public void setJavaType(int javaType)
public int getJavaType()
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.