Package org.apache.openjpa.jdbc.sql
Class LogicalUnion
java.lang.Object
org.apache.openjpa.jdbc.sql.LogicalUnion
- All Implemented Interfaces:
SelectExecutor,Union
A logical union made up of multiple distinct selects whose results are
combined in memory.
- Author:
- Abe White
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA callback used to create the selects in a SQL union.classA select that is part of a logical union. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BitSetprotected final DBDictionaryprotected final ClassMapping[]protected final LogicalUnion.UnionSelect[] -
Constructor Summary
ConstructorsModifierConstructorDescriptionLogicalUnion(JDBCConfiguration conf, int sels) Constructor.protectedLogicalUnion(JDBCConfiguration conf, int sels, Select[] seeds) Delegate constructor.LogicalUnion(JDBCConfiguration conf, Select[] seeds) Constructor used to seed the internal selects. -
Method Summary
Modifier and TypeMethodDescriptionvoidForce the use of a series of standard selects rather than a true UNION.execute(JDBCStore store, JDBCFetchConfiguration fetch) Execute this select in the context of the given store manager.execute(JDBCStore store, JDBCFetchConfiguration fetch, int lockLevel) Execute this select in the context of the given store manager.booleanWhether to automatically make results distinct when relational joins would otherwise introduce duplicates.Return the select configuration.intReturn the number of instances matching this select.intThe expected result count for the query.intThe join syntax for this select, as one of the syntax constants fromJoinSyntaxes.Get the union-level ordering, if any.Select[]Return the selects that make up this union.getSQL()Get the buffer if it has been computed by a previous call toSelectExecutor.toSelect(boolean, JDBCFetchConfiguration), if any.booleanAffirm if this receiver requires more than one selects to fetch its data.booleanWhether this is a SELECT DISTINCT / UNION ALL.booleanisLRS()Whether the result of this select should be treated as a large result set.booleanisUnion()Whether this is a true UNION, rather than a logical combination of independent selects.protected LogicalUnion.UnionSelectnewUnionSelect(SelectImpl seed, int pos) Create a new union select with the given delegate and union position.voidselect(Union.Selector selector) Select data using the given selector.voidsetAutoDistinct(boolean distinct) Whether to automatically make results distinct when relational joins would otherwise introduce duplicates.voidsetDistinct(boolean distinct) Whether this is a SELECT DISTINCT / UNION ALL.voidsetExpectedResultCount(int expectedResultCount, boolean force) The expected result count for the query.voidsetJoinSyntax(int syntax) The join syntax for this select, as one of the syntax constants fromJoinSyntaxes.voidsetLRS(boolean lrs) Whether the result of this select should be treated as a large result set.booleanWhether this select can be executed for update.booleansupportsRandomAccess(boolean forUpdate) Return whether this select can support a random access result set type.toSelect(boolean forUpdate, JDBCFetchConfiguration fetch) Return this select as a SQL statement formatted for the current dictionary.Return this select as a COUNT SQL statement formatted for the current dictionary.toString()
-
Field Details
-
sels
-
dict
-
mappings
-
desc
-
-
Constructor Details
-
LogicalUnion
Constructor.- Parameters:
conf- system configurationsels- the number of SQL selects to union together
-
LogicalUnion
Constructor used to seed the internal selects. -
LogicalUnion
Delegate constructor.
-
-
Method Details
-
newUnionSelect
Create a new union select with the given delegate and union position. -
getSelects
Description copied from interface:UnionReturn the selects that make up this union.- Specified by:
getSelectsin interfaceUnion
-
isUnion
public boolean isUnion()Description copied from interface:UnionWhether this is a true UNION, rather than a logical combination of independent selects. -
abortUnion
public void abortUnion()Description copied from interface:UnionForce the use of a series of standard selects rather than a true UNION.- Specified by:
abortUnionin interfaceUnion
-
getOrdering
Description copied from interface:UnionGet the union-level ordering, if any.- Specified by:
getOrderingin interfaceUnion
-
getConfiguration
Description copied from interface:SelectExecutorReturn the select configuration.- Specified by:
getConfigurationin interfaceSelectExecutor
-
getDBDictionary
-
toSelect
Description copied from interface:SelectExecutorReturn this select as a SQL statement formatted for the current dictionary.- Specified by:
toSelectin interfaceSelectExecutor
-
getSQL
Description copied from interface:SelectExecutorGet the buffer if it has been computed by a previous call toSelectExecutor.toSelect(boolean, JDBCFetchConfiguration), if any.- Specified by:
getSQLin interfaceSelectExecutor
-
toSelectCount
Description copied from interface:SelectExecutorReturn this select as a COUNT SQL statement formatted for the current dictionary.- Specified by:
toSelectCountin interfaceSelectExecutor
-
getAutoDistinct
public boolean getAutoDistinct()Description copied from interface:SelectExecutorWhether to automatically make results distinct when relational joins would otherwise introduce duplicates.- Specified by:
getAutoDistinctin interfaceSelectExecutor
-
setAutoDistinct
public void setAutoDistinct(boolean distinct) Description copied from interface:SelectExecutorWhether to automatically make results distinct when relational joins would otherwise introduce duplicates.- Specified by:
setAutoDistinctin interfaceSelectExecutor
-
isDistinct
public boolean isDistinct()Description copied from interface:SelectExecutorWhether this is a SELECT DISTINCT / UNION ALL.- Specified by:
isDistinctin interfaceSelectExecutor
-
setDistinct
public void setDistinct(boolean distinct) Description copied from interface:SelectExecutorWhether this is a SELECT DISTINCT / UNION ALL.- Specified by:
setDistinctin interfaceSelectExecutor
-
isLRS
public boolean isLRS()Description copied from interface:SelectExecutorWhether the result of this select should be treated as a large result set.- Specified by:
isLRSin interfaceSelectExecutor
-
setLRS
public void setLRS(boolean lrs) Description copied from interface:SelectExecutorWhether the result of this select should be treated as a large result set.- Specified by:
setLRSin interfaceSelectExecutor
-
getExpectedResultCount
public int getExpectedResultCount()Description copied from interface:SelectExecutorThe expected result count for the query.- Specified by:
getExpectedResultCountin interfaceSelectExecutor
-
setExpectedResultCount
public void setExpectedResultCount(int expectedResultCount, boolean force) Description copied from interface:SelectExecutorThe expected result count for the query.- Specified by:
setExpectedResultCountin interfaceSelectExecutorforce- if false, the count will be discarded if this select has any to-many eager joins that would throw off the result count
-
getJoinSyntax
public int getJoinSyntax()Description copied from interface:SelectExecutorThe join syntax for this select, as one of the syntax constants fromJoinSyntaxes.- Specified by:
getJoinSyntaxin interfaceSelectExecutor
-
setJoinSyntax
public void setJoinSyntax(int syntax) Description copied from interface:SelectExecutorThe join syntax for this select, as one of the syntax constants fromJoinSyntaxes.- Specified by:
setJoinSyntaxin interfaceSelectExecutor
-
supportsRandomAccess
public boolean supportsRandomAccess(boolean forUpdate) Description copied from interface:SelectExecutorReturn whether this select can support a random access result set type.- Specified by:
supportsRandomAccessin interfaceSelectExecutor
-
supportsLocking
public boolean supportsLocking()Description copied from interface:SelectExecutorWhether this select can be executed for update.- Specified by:
supportsLockingin interfaceSelectExecutor
-
hasMultipleSelects
public boolean hasMultipleSelects()Description copied from interface:SelectExecutorAffirm if this receiver requires more than one selects to fetch its data.- Specified by:
hasMultipleSelectsin interfaceSelectExecutor
-
getCount
Description copied from interface:SelectExecutorReturn the number of instances matching this select.- Specified by:
getCountin interfaceSelectExecutor- Throws:
SQLException
-
execute
Description copied from interface:SelectExecutorExecute this select in the context of the given store manager.- Specified by:
executein interfaceSelectExecutor- Throws:
SQLException
-
execute
public Result execute(JDBCStore store, JDBCFetchConfiguration fetch, int lockLevel) throws SQLException Description copied from interface:SelectExecutorExecute this select in the context of the given store manager.- Specified by:
executein interfaceSelectExecutor- Throws:
SQLException
-
select
Description copied from interface:UnionSelect data using the given selector. -
toString
-