org.apache.openjpa.jdbc.meta
Interface DiscriminatorStrategy

All Superinterfaces:
Serializable, Strategy
All Known Implementing Classes:
AbstractDiscriminatorStrategy, ClassNameDiscriminatorStrategy, Discriminator, InValueDiscriminatorStrategy, NoneDiscriminatorStrategy, SubclassJoinDiscriminatorStrategy, SuperclassDiscriminatorStrategy, ValueMapDiscriminatorStrategy

public interface DiscriminatorStrategy
extends Strategy

Handles determining the object class of database records.

Author:
Abe White

Method Summary
 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.
 boolean hasClassConditions(ClassMapping base, boolean subs)
          Whether any class conditions are necessary.
 void loadSubclasses(JDBCStore store)
          Load all subclasses of the owning class mapping into the JVM.
 boolean select(Select sel, ClassMapping mapping)
          Select the data for this Discriminator.
 void setDiscriminator(Discriminator owner)
          Set the Discriminator that uses this strategy.
 
Methods inherited from interface org.apache.openjpa.jdbc.meta.Strategy
customDelete, customInsert, customUpdate, delete, getAlias, initialize, insert, isCustomDelete, isCustomInsert, isCustomUpdate, map, update
 

Method Detail

setDiscriminator

void setDiscriminator(Discriminator owner)
Set the Discriminator that uses this strategy. This will be called before use.


select

boolean select(Select sel,
               ClassMapping mapping)
Select the data for this Discriminator.

Parameters:
mapping - the known base class being selected; this may not be the base class in the inheritance hierarchy
Returns:
true if anything was selected; false otherwise

loadSubclasses

void loadSubclasses(JDBCStore store)
                    throws SQLException,
                           ClassNotFoundException
Load all subclasses of the owning class mapping into the JVM.

Throws:
SQLException
ClassNotFoundException

getClass

Class<?> getClass(JDBCStore store,
                  ClassMapping base,
                  Result result)
                  throws SQLException,
                         ClassNotFoundException
Return the class for the current result row.

Throws:
SQLException
ClassNotFoundException

hasClassConditions

boolean hasClassConditions(ClassMapping base,
                           boolean subs)
Whether any class conditions are necessary.

See Also:
getClassConditions(org.apache.openjpa.jdbc.sql.Select, org.apache.openjpa.jdbc.sql.Joins, org.apache.openjpa.jdbc.meta.ClassMapping, boolean)

getClassConditions

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. The select and joins instances are supplied in order to get column aliases.



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