Package org.teiid.translator.jpa
Class JPA2ExecutionFactory
- java.lang.Object
-
- org.teiid.translator.ExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
- org.teiid.translator.jpa.JPA2ExecutionFactory
-
@Translator(name="jpa2", description="A translator for JPA2 based entities") public class JPA2ExecutionFactory extends ExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.teiid.translator.ExecutionFactory
ExecutionFactory.Format, ExecutionFactory.NullOrder, ExecutionFactory.SupportedJoinCriteria, ExecutionFactory.TransactionSupport
-
-
Field Summary
-
Fields inherited from class org.teiid.translator.ExecutionFactory
DEFAULT_MAX_FROM_GROUPS, DEFAULT_MAX_IN_CRITERIA_SIZE, DEFAULT_MAX_PROJECTED_COLUMNS
-
-
Constructor Summary
Constructors Constructor Description JPA2ExecutionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeConnection(javax.persistence.EntityManager connection, javax.persistence.EntityManagerFactory factory)
Closes a connection object from the given connection factory.ProcedureExecution
createDirectExecution(List<Argument> arguments, Command command, ExecutionContext executionContext, RuntimeMetadata metadata, javax.persistence.EntityManager connection)
ProcedureExecution
createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, javax.persistence.EntityManager connection)
ResultSetExecution
createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, javax.persistence.EntityManager connection)
UpdateExecution
createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, javax.persistence.EntityManager connection)
javax.persistence.EntityManager
getConnection(javax.persistence.EntityManagerFactory factory, ExecutionContext executionContext)
Return a connection object from the given connection factory.List<String>
getDefaultSupportedFunctions()
Map<String,FunctionModifier>
getFunctionModifiers()
Return a map of function name to FunctionModifier.MetadataProcessor<javax.persistence.EntityManager>
getMetadataProcessor()
Get a MetadataProcessor for the translator to read the metadata.List<String>
getSupportedFunctions()
Get list of all supported function names.void
registerFunctionModifier(String name, FunctionModifier modifier)
Add theFunctionModifier
to the set of known modifiers.void
start()
Initialize the connector with supplied configurationboolean
supportsAggregatesAvg()
Support indicates connector can accept the AVG aggregate functionboolean
supportsAggregatesCount()
Support indicates connector can accept the COUNT aggregate functionboolean
supportsAggregatesCountStar()
Support indicates connector can accept the COUNT(*) aggregate functionboolean
supportsAggregatesDistinct()
Support indicates connector can accept DISTINCT within aggregate functionsboolean
supportsAggregatesMax()
Support indicates connector can accept the MAX aggregate functionboolean
supportsAggregatesMin()
Support indicates connector can accept the MIN aggregate functionboolean
supportsAggregatesSum()
Support indicates connector can accept the SUM aggregate functionboolean
supportsAliasedTable()
Support indicates connector can accept groups with aliasesboolean
supportsCompareCriteriaEquals()
Support indicates connector accepts criteria of form (element = constant)boolean
supportsCompareCriteriaOrdered()
Support indicates connector accepts criteria of form (element <=|>= constant)
The query engine will may pushdown queries containing < or > if NOT is also supported.boolean
supportsDependentJoins()
NOTE: The pushed independent tuples will not have been converted to a unique set and may contain duplicates.boolean
supportsExistsCriteria()
Support indicates connector accepts the EXISTS criteriaboolean
supportsGroupBy()
Whether the source supports an explicit GROUP BY clauseboolean
supportsHaving()
Whether the source supports the HAVING clauseboolean
supportsInCriteria()
Support indicates connector accepts criteria of form (element IN set)boolean
supportsInCriteriaSubquery()
Support indicates connector accepts IN criteria with a subquery on the right sideboolean
supportsInlineViews()
Support indicates connector can accept inline views (subqueries in the FROM clause).boolean
supportsIsNullCriteria()
Support indicates connector accepts criteria of form (element IS NULL)boolean
supportsLikeCriteria()
Support indicates connector accepts criteria of form (element LIKE constant)boolean
supportsNotCriteria()
Support indicates connector accepts logical criteria NOTboolean
supportsOrCriteria()
Support indicates connector accepts logical criteria connected by ORboolean
supportsRowLimit()
Gets whether the connector can limit the number of rows returned by a query.boolean
supportsRowOffset()
Gets whether the connector supports a SQL clause (similar to the LIMIT with an offset) that can return result sets that start in the middle of the resulting rows returned by a queryboolean
supportsScalarSubqueries()
Support indicates connector can accept scalar subqueries in the SELECT, WHERE, and HAVING clausesboolean
supportsSelectExpression()
Support indicates connector can accept expressions other than element symbols in the SELECT clause.boolean
supportsSelfJoins()
Support indicates connector can accept self-joins where a group is joined to itself with aliases.boolean
useAnsiJoin()
Whether the source prefers to use ANSI style joins.-
Methods inherited from class org.teiid.translator.ExecutionFactory
addPushDownFunction, areLobsUsableAfterClose, createExecution, getCacheDirective, getCollationLocale, getConnection, getDefaultNullOrder, getDirectQueryProcedureName, getExcludedCommonTableExpressionName, getInstance, getLanguageFactory, getMaxDependentInPredicates, getMaxFromGroups, getMaxInCriteriaSize, getMaxProjectedColumns, getMetadata, getNativeQueryProcedureName, getPushDownFunctions, getRequiredLikeEscape, getSupportedJoinCriteria, getTransactionSupport, getTypeFacility, initCapabilities, isCopyLobs, isForkable, isImmutable, isSourceRequired, isSourceRequiredForCapabilities, isSourceRequiredForMetadata, isThreadBound, requiresCriteria, returnsSingleUpdateCount, setCollationLocale, setCopyLobs, setDirectQueryProcedureName, setExcludedCommonTableExpressionName, setImmutable, setMaxDependentInPredicates, setMaxInCriteriaSize, setNativeQueryProcedureName, setRequiresCriteria, setSourceRequired, setSourceRequiredForMetadata, setSupportedJoinCriteria, setSupportsDirectQueryProcedure, setSupportsFullOuterJoins, setSupportsInnerJoins, setSupportsNativeQueries, setSupportsOrderBy, setSupportsOuterJoins, setSupportsSelectDistinct, setThreadBound, setTransactionSupport, supportsAdvancedOlapOperations, supportsAggregatesCountBig, supportsAggregatesEnhancedNumeric, supportsArrayAgg, supportsArrayType, supportsBatchedUpdates, supportsBulkUpdate, supportsCommonTableExpressions, supportsCompareCriteriaOrderedExclusive, supportsConvert, supportsCorrelatedSubqueries, supportsCorrelatedSubqueryLimit, supportsDirectQueryProcedure, supportsElementaryOlapOperations, supportsExcept, supportsFormatLiteral, supportsFullDependentJoins, supportsFullOuterJoins, supportsFunctionsInGroupBy, supportsGeographyType, supportsGroupByMultipleDistinctAggregates, supportsGroupByRollup, supportsInnerJoins, supportsInsertWithQueryExpression, supportsIntersect, supportsIsDistinctCriteria, supportsLateralJoin, supportsLateralJoinCondition, supportsLikeCriteriaEscapeCharacter, supportsLikeRegex, supportsListAgg, supportsMultipleOpenExecutions, supportsNativeQueries, supportsOnlyCorrelatedSubqueries, supportsOnlyFormatLiterals, supportsOnlyLateralJoinProcedure, supportsOnlyLiteralComparison, supportsOnlySingleTableGroupBy, supportsOnlyTimestampAddLiteral, supportsOrderBy, supportsOrderByNullOrdering, supportsOrderByUnrelated, supportsOrderByWithExtendedGrouping, supportsOuterJoins, supportsPartialFiltering, supportsProcedureParameterExpression, supportsProcedureTable, supportsQuantifiedCompareCriteriaAll, supportsQuantifiedCompareCriteriaSome, supportsRecursiveCommonTableExpressions, supportsScalarSubqueryProjection, supportsSearchedCaseExpressions, supportsSelectDistinct, supportsSelectExpressionArrayType, supportsSelectWithoutFrom, supportsSetQueryLimitOffset, supportsSetQueryOrderBy, supportsSimilarTo, supportsStringAgg, supportsSubqueryCommonTableExpressions, supportsSubqueryInOn, supportsUnions, supportsUpsert, supportsWindowDistinctAggregates, supportsWindowFrameClause, supportsWindowFunctionCumeDist, supportsWindowFunctionNthValue, supportsWindowFunctionNtile, supportsWindowFunctionPercentRank, supportsWindowOrderByWithAggregates, useBindingsForDependentJoin
-
-
-
-
Method Detail
-
start
public void start() throws TranslatorException
Description copied from class:ExecutionFactory
Initialize the connector with supplied configuration- Overrides:
start
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
- Throws:
TranslatorException
-
getConnection
public javax.persistence.EntityManager getConnection(javax.persistence.EntityManagerFactory factory, ExecutionContext executionContext) throws TranslatorException
Description copied from class:ExecutionFactory
Return a connection object from the given connection factory. The default implementation assumes a JCAConnectionFactory
. Subclasses should override, if they use another type of connection factory or wish to use theExecutionContext
. By default callsExecutionFactory.getConnection(Object)
- Overrides:
getConnection
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
executionContext
- null if this is a system request for a connection- Returns:
- a connection
- Throws:
TranslatorException
-
closeConnection
public void closeConnection(javax.persistence.EntityManager connection, javax.persistence.EntityManagerFactory factory)
Description copied from class:ExecutionFactory
Closes a connection object from the given connection factory. The default implementation assumes a JCAConnection
. Subclasses should override, if they use another type of connection.- Overrides:
closeConnection
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
createResultSetExecution
public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, javax.persistence.EntityManager connection) throws TranslatorException
- Overrides:
createResultSetExecution
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
- Throws:
TranslatorException
-
createProcedureExecution
public ProcedureExecution createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, javax.persistence.EntityManager connection) throws TranslatorException
- Overrides:
createProcedureExecution
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
- Throws:
TranslatorException
-
createUpdateExecution
public UpdateExecution createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, javax.persistence.EntityManager connection) throws TranslatorException
- Overrides:
createUpdateExecution
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
- Throws:
TranslatorException
-
createDirectExecution
public ProcedureExecution createDirectExecution(List<Argument> arguments, Command command, ExecutionContext executionContext, RuntimeMetadata metadata, javax.persistence.EntityManager connection) throws TranslatorException
- Overrides:
createDirectExecution
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
- Throws:
TranslatorException
-
getMetadataProcessor
public MetadataProcessor<javax.persistence.EntityManager> getMetadataProcessor()
Description copied from class:ExecutionFactory
Get a MetadataProcessor for the translator to read the metadata. Typically this will return a new instance.- Overrides:
getMetadataProcessor
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
- Returns:
-
supportsSelectExpression
public boolean supportsSelectExpression()
Description copied from class:ExecutionFactory
Support indicates connector can accept expressions other than element symbols in the SELECT clause. Specific supports for the expression type are still checked.- Overrides:
supportsSelectExpression
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAliasedTable
public boolean supportsAliasedTable()
Description copied from class:ExecutionFactory
Support indicates connector can accept groups with aliases- Overrides:
supportsAliasedTable
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsInlineViews
public boolean supportsInlineViews()
Description copied from class:ExecutionFactory
Support indicates connector can accept inline views (subqueries in the FROM clause).- Overrides:
supportsInlineViews
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsCompareCriteriaEquals
public boolean supportsCompareCriteriaEquals()
Description copied from class:ExecutionFactory
Support indicates connector accepts criteria of form (element = constant)- Overrides:
supportsCompareCriteriaEquals
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsCompareCriteriaOrdered
public boolean supportsCompareCriteriaOrdered()
Description copied from class:ExecutionFactory
Support indicates connector accepts criteria of form (element <=|>= constant)
The query engine will may pushdown queries containing < or > if NOT is also supported.- Overrides:
supportsCompareCriteriaOrdered
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsLikeCriteria
public boolean supportsLikeCriteria()
Description copied from class:ExecutionFactory
Support indicates connector accepts criteria of form (element LIKE constant)- Overrides:
supportsLikeCriteria
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsInCriteria
public boolean supportsInCriteria()
Description copied from class:ExecutionFactory
Support indicates connector accepts criteria of form (element IN set)- Overrides:
supportsInCriteria
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsInCriteriaSubquery
public boolean supportsInCriteriaSubquery()
Description copied from class:ExecutionFactory
Support indicates connector accepts IN criteria with a subquery on the right side- Overrides:
supportsInCriteriaSubquery
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsIsNullCriteria
public boolean supportsIsNullCriteria()
Description copied from class:ExecutionFactory
Support indicates connector accepts criteria of form (element IS NULL)- Overrides:
supportsIsNullCriteria
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsOrCriteria
public boolean supportsOrCriteria()
Description copied from class:ExecutionFactory
Support indicates connector accepts logical criteria connected by OR- Overrides:
supportsOrCriteria
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsNotCriteria
public boolean supportsNotCriteria()
Description copied from class:ExecutionFactory
Support indicates connector accepts logical criteria NOT- Overrides:
supportsNotCriteria
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsExistsCriteria
public boolean supportsExistsCriteria()
Description copied from class:ExecutionFactory
Support indicates connector accepts the EXISTS criteria- Overrides:
supportsExistsCriteria
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsGroupBy
public boolean supportsGroupBy()
Description copied from class:ExecutionFactory
Whether the source supports an explicit GROUP BY clause- Overrides:
supportsGroupBy
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsHaving
public boolean supportsHaving()
Description copied from class:ExecutionFactory
Whether the source supports the HAVING clause- Overrides:
supportsHaving
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesSum
public boolean supportsAggregatesSum()
Description copied from class:ExecutionFactory
Support indicates connector can accept the SUM aggregate function- Overrides:
supportsAggregatesSum
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesAvg
public boolean supportsAggregatesAvg()
Description copied from class:ExecutionFactory
Support indicates connector can accept the AVG aggregate function- Overrides:
supportsAggregatesAvg
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesMin
public boolean supportsAggregatesMin()
Description copied from class:ExecutionFactory
Support indicates connector can accept the MIN aggregate function- Overrides:
supportsAggregatesMin
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesMax
public boolean supportsAggregatesMax()
Description copied from class:ExecutionFactory
Support indicates connector can accept the MAX aggregate function- Overrides:
supportsAggregatesMax
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesCount
public boolean supportsAggregatesCount()
Description copied from class:ExecutionFactory
Support indicates connector can accept the COUNT aggregate function- Overrides:
supportsAggregatesCount
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesCountStar
public boolean supportsAggregatesCountStar()
Description copied from class:ExecutionFactory
Support indicates connector can accept the COUNT(*) aggregate function- Overrides:
supportsAggregatesCountStar
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesDistinct
public boolean supportsAggregatesDistinct()
Description copied from class:ExecutionFactory
Support indicates connector can accept DISTINCT within aggregate functions- Overrides:
supportsAggregatesDistinct
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsScalarSubqueries
public boolean supportsScalarSubqueries()
Description copied from class:ExecutionFactory
Support indicates connector can accept scalar subqueries in the SELECT, WHERE, and HAVING clauses- Overrides:
supportsScalarSubqueries
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
useAnsiJoin
public boolean useAnsiJoin()
Description copied from class:ExecutionFactory
Whether the source prefers to use ANSI style joins.- Overrides:
useAnsiJoin
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsDependentJoins
public boolean supportsDependentJoins()
Description copied from class:ExecutionFactory
NOTE: The pushed independent tuples will not have been converted to a unique set and may contain duplicates.- Overrides:
supportsDependentJoins
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
- Returns:
- true if dependent join key pushdown is supported
-
supportsSelfJoins
public boolean supportsSelfJoins()
Description copied from class:ExecutionFactory
Support indicates connector can accept self-joins where a group is joined to itself with aliases. Connector must also supportExecutionFactory.supportsAliasedTable()
.- Overrides:
supportsSelfJoins
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsRowLimit
public boolean supportsRowLimit()
Description copied from class:ExecutionFactory
Gets whether the connector can limit the number of rows returned by a query.- Overrides:
supportsRowLimit
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsRowOffset
public boolean supportsRowOffset()
Description copied from class:ExecutionFactory
Gets whether the connector supports a SQL clause (similar to the LIMIT with an offset) that can return result sets that start in the middle of the resulting rows returned by a query- Overrides:
supportsRowOffset
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
getSupportedFunctions
public List<String> getSupportedFunctions()
Description copied from class:ExecutionFactory
Get list of all supported function names. Arithmetic functions have names like "+".- Overrides:
getSupportedFunctions
in classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
- See Also:
for a listing of system pushdown functions. Note that not all system functions are listed as some functions will use a common name such as CONCAT vs. the || operator, and other functions will be rewritten and not pushed down, such as SPACE. Note: User defined functions should be specified fully qualified.
-
getFunctionModifiers
public Map<String,FunctionModifier> getFunctionModifiers()
Return a map of function name to FunctionModifier.- Returns:
- Map of function name to FunctionModifier.
-
registerFunctionModifier
public void registerFunctionModifier(String name, FunctionModifier modifier)
Add theFunctionModifier
to the set of known modifiers.- Parameters:
name
-modifier
-
-
-