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 voidcloseConnection(javax.persistence.EntityManager connection, javax.persistence.EntityManagerFactory factory)Closes a connection object from the given connection factory.ProcedureExecutioncreateDirectExecution(List<Argument> arguments, Command command, ExecutionContext executionContext, RuntimeMetadata metadata, javax.persistence.EntityManager connection)ProcedureExecutioncreateProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, javax.persistence.EntityManager connection)ResultSetExecutioncreateResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, javax.persistence.EntityManager connection)UpdateExecutioncreateUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, javax.persistence.EntityManager connection)javax.persistence.EntityManagergetConnection(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.voidregisterFunctionModifier(String name, FunctionModifier modifier)Add theFunctionModifierto the set of known modifiers.voidstart()Initialize the connector with supplied configurationbooleansupportsAggregatesAvg()Support indicates connector can accept the AVG aggregate functionbooleansupportsAggregatesCount()Support indicates connector can accept the COUNT aggregate functionbooleansupportsAggregatesCountStar()Support indicates connector can accept the COUNT(*) aggregate functionbooleansupportsAggregatesDistinct()Support indicates connector can accept DISTINCT within aggregate functionsbooleansupportsAggregatesMax()Support indicates connector can accept the MAX aggregate functionbooleansupportsAggregatesMin()Support indicates connector can accept the MIN aggregate functionbooleansupportsAggregatesSum()Support indicates connector can accept the SUM aggregate functionbooleansupportsAliasedTable()Support indicates connector can accept groups with aliasesbooleansupportsCompareCriteriaEquals()Support indicates connector accepts criteria of form (element = constant)booleansupportsCompareCriteriaOrdered()Support indicates connector accepts criteria of form (element <=|>= constant)
The query engine will may pushdown queries containing < or > if NOT is also supported.booleansupportsDependentJoins()NOTE: The pushed independent tuples will not have been converted to a unique set and may contain duplicates.booleansupportsExistsCriteria()Support indicates connector accepts the EXISTS criteriabooleansupportsGroupBy()Whether the source supports an explicit GROUP BY clausebooleansupportsHaving()Whether the source supports the HAVING clausebooleansupportsInCriteria()Support indicates connector accepts criteria of form (element IN set)booleansupportsInCriteriaSubquery()Support indicates connector accepts IN criteria with a subquery on the right sidebooleansupportsInlineViews()Support indicates connector can accept inline views (subqueries in the FROM clause).booleansupportsIsNullCriteria()Support indicates connector accepts criteria of form (element IS NULL)booleansupportsLikeCriteria()Support indicates connector accepts criteria of form (element LIKE constant)booleansupportsNotCriteria()Support indicates connector accepts logical criteria NOTbooleansupportsOrCriteria()Support indicates connector accepts logical criteria connected by ORbooleansupportsRowLimit()Gets whether the connector can limit the number of rows returned by a query.booleansupportsRowOffset()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 querybooleansupportsScalarSubqueries()Support indicates connector can accept scalar subqueries in the SELECT, WHERE, and HAVING clausesbooleansupportsSelectExpression()Support indicates connector can accept expressions other than element symbols in the SELECT clause.booleansupportsSelfJoins()Support indicates connector can accept self-joins where a group is joined to itself with aliases.booleanuseAnsiJoin()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, supportsOnlyRelationshipStyleJoins, 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 TranslatorExceptionDescription copied from class:ExecutionFactoryInitialize the connector with supplied configuration- Overrides:
startin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>- Throws:
TranslatorException
-
getConnection
public javax.persistence.EntityManager getConnection(javax.persistence.EntityManagerFactory factory, ExecutionContext executionContext) throws TranslatorExceptionDescription copied from class:ExecutionFactoryReturn 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:
getConnectionin 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:ExecutionFactoryCloses 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:
closeConnectionin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
createResultSetExecution
public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, javax.persistence.EntityManager connection) throws TranslatorException
- Overrides:
createResultSetExecutionin 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:
createProcedureExecutionin 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:
createUpdateExecutionin 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:
createDirectExecutionin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>- Throws:
TranslatorException
-
getMetadataProcessor
public MetadataProcessor<javax.persistence.EntityManager> getMetadataProcessor()
Description copied from class:ExecutionFactoryGet a MetadataProcessor for the translator to read the metadata. Typically this will return a new instance.- Overrides:
getMetadataProcessorin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>- Returns:
-
supportsSelectExpression
public boolean supportsSelectExpression()
Description copied from class:ExecutionFactorySupport indicates connector can accept expressions other than element symbols in the SELECT clause. Specific supports for the expression type are still checked.- Overrides:
supportsSelectExpressionin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAliasedTable
public boolean supportsAliasedTable()
Description copied from class:ExecutionFactorySupport indicates connector can accept groups with aliases- Overrides:
supportsAliasedTablein classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsInlineViews
public boolean supportsInlineViews()
Description copied from class:ExecutionFactorySupport indicates connector can accept inline views (subqueries in the FROM clause).- Overrides:
supportsInlineViewsin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsCompareCriteriaEquals
public boolean supportsCompareCriteriaEquals()
Description copied from class:ExecutionFactorySupport indicates connector accepts criteria of form (element = constant)- Overrides:
supportsCompareCriteriaEqualsin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsCompareCriteriaOrdered
public boolean supportsCompareCriteriaOrdered()
Description copied from class:ExecutionFactorySupport indicates connector accepts criteria of form (element <=|>= constant)
The query engine will may pushdown queries containing < or > if NOT is also supported.- Overrides:
supportsCompareCriteriaOrderedin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsLikeCriteria
public boolean supportsLikeCriteria()
Description copied from class:ExecutionFactorySupport indicates connector accepts criteria of form (element LIKE constant)- Overrides:
supportsLikeCriteriain classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsInCriteria
public boolean supportsInCriteria()
Description copied from class:ExecutionFactorySupport indicates connector accepts criteria of form (element IN set)- Overrides:
supportsInCriteriain classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsInCriteriaSubquery
public boolean supportsInCriteriaSubquery()
Description copied from class:ExecutionFactorySupport indicates connector accepts IN criteria with a subquery on the right side- Overrides:
supportsInCriteriaSubqueryin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsIsNullCriteria
public boolean supportsIsNullCriteria()
Description copied from class:ExecutionFactorySupport indicates connector accepts criteria of form (element IS NULL)- Overrides:
supportsIsNullCriteriain classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsOrCriteria
public boolean supportsOrCriteria()
Description copied from class:ExecutionFactorySupport indicates connector accepts logical criteria connected by OR- Overrides:
supportsOrCriteriain classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsNotCriteria
public boolean supportsNotCriteria()
Description copied from class:ExecutionFactorySupport indicates connector accepts logical criteria NOT- Overrides:
supportsNotCriteriain classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsExistsCriteria
public boolean supportsExistsCriteria()
Description copied from class:ExecutionFactorySupport indicates connector accepts the EXISTS criteria- Overrides:
supportsExistsCriteriain classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsGroupBy
public boolean supportsGroupBy()
Description copied from class:ExecutionFactoryWhether the source supports an explicit GROUP BY clause- Overrides:
supportsGroupByin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsHaving
public boolean supportsHaving()
Description copied from class:ExecutionFactoryWhether the source supports the HAVING clause- Overrides:
supportsHavingin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesSum
public boolean supportsAggregatesSum()
Description copied from class:ExecutionFactorySupport indicates connector can accept the SUM aggregate function- Overrides:
supportsAggregatesSumin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesAvg
public boolean supportsAggregatesAvg()
Description copied from class:ExecutionFactorySupport indicates connector can accept the AVG aggregate function- Overrides:
supportsAggregatesAvgin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesMin
public boolean supportsAggregatesMin()
Description copied from class:ExecutionFactorySupport indicates connector can accept the MIN aggregate function- Overrides:
supportsAggregatesMinin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesMax
public boolean supportsAggregatesMax()
Description copied from class:ExecutionFactorySupport indicates connector can accept the MAX aggregate function- Overrides:
supportsAggregatesMaxin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesCount
public boolean supportsAggregatesCount()
Description copied from class:ExecutionFactorySupport indicates connector can accept the COUNT aggregate function- Overrides:
supportsAggregatesCountin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesCountStar
public boolean supportsAggregatesCountStar()
Description copied from class:ExecutionFactorySupport indicates connector can accept the COUNT(*) aggregate function- Overrides:
supportsAggregatesCountStarin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsAggregatesDistinct
public boolean supportsAggregatesDistinct()
Description copied from class:ExecutionFactorySupport indicates connector can accept DISTINCT within aggregate functions- Overrides:
supportsAggregatesDistinctin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsScalarSubqueries
public boolean supportsScalarSubqueries()
Description copied from class:ExecutionFactorySupport indicates connector can accept scalar subqueries in the SELECT, WHERE, and HAVING clauses- Overrides:
supportsScalarSubqueriesin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
useAnsiJoin
public boolean useAnsiJoin()
Description copied from class:ExecutionFactoryWhether the source prefers to use ANSI style joins.- Overrides:
useAnsiJoinin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsDependentJoins
public boolean supportsDependentJoins()
Description copied from class:ExecutionFactoryNOTE: The pushed independent tuples will not have been converted to a unique set and may contain duplicates.- Overrides:
supportsDependentJoinsin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>- Returns:
- true if dependent join key pushdown is supported
-
supportsSelfJoins
public boolean supportsSelfJoins()
Description copied from class:ExecutionFactorySupport indicates connector can accept self-joins where a group is joined to itself with aliases. Connector must also supportExecutionFactory.supportsAliasedTable().- Overrides:
supportsSelfJoinsin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsRowLimit
public boolean supportsRowLimit()
Description copied from class:ExecutionFactoryGets whether the connector can limit the number of rows returned by a query.- Overrides:
supportsRowLimitin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
supportsRowOffset
public boolean supportsRowOffset()
Description copied from class:ExecutionFactoryGets 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:
supportsRowOffsetin classExecutionFactory<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager>
-
getSupportedFunctions
public List<String> getSupportedFunctions()
Description copied from class:ExecutionFactoryGet list of all supported function names. Arithmetic functions have names like "+".- Overrides:
getSupportedFunctionsin 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 theFunctionModifierto the set of known modifiers.- Parameters:
name-modifier-
-
-