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
Modifier and TypeClassDescriptionstatic interface
A callback used to create the selects in a SQL union.class
A select that is part of a logical union. -
Field Summary
Modifier and TypeFieldDescriptionprotected final BitSet
protected final DBDictionary
protected final ClassMapping[]
protected final LogicalUnion.UnionSelect[]
-
Constructor Summary
ModifierConstructorDescriptionLogicalUnion
(JDBCConfiguration conf, int sels) Constructor.protected
LogicalUnion
(JDBCConfiguration conf, int sels, Select[] seeds) Delegate constructor.LogicalUnion
(JDBCConfiguration conf, Select[] seeds) Constructor used to seed the internal selects. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Force 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.boolean
Whether to automatically make results distinct when relational joins would otherwise introduce duplicates.Return the select configuration.int
Return the number of instances matching this select.int
The expected result count for the query.int
The 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.boolean
Affirm if this receiver requires more than one selects to fetch its data.boolean
Whether this is a SELECT DISTINCT / UNION ALL.boolean
isLRS()
Whether the result of this select should be treated as a large result set.boolean
isUnion()
Whether this is a true UNION, rather than a logical combination of independent selects.protected LogicalUnion.UnionSelect
newUnionSelect
(SelectImpl seed, int pos) Create a new union select with the given delegate and union position.void
select
(Union.Selector selector) Select data using the given selector.void
setAutoDistinct
(boolean distinct) Whether to automatically make results distinct when relational joins would otherwise introduce duplicates.void
setDistinct
(boolean distinct) Whether this is a SELECT DISTINCT / UNION ALL.void
setExpectedResultCount
(int expectedResultCount, boolean force) The expected result count for the query.void
setJoinSyntax
(int syntax) The join syntax for this select, as one of the syntax constants fromJoinSyntaxes
.void
setLRS
(boolean lrs) Whether the result of this select should be treated as a large result set.boolean
Whether this select can be executed for update.boolean
supportsRandomAccess
(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:Union
Return the selects that make up this union.- Specified by:
getSelects
in interfaceUnion
-
isUnion
public boolean isUnion()Description copied from interface:Union
Whether this is a true UNION, rather than a logical combination of independent selects. -
abortUnion
public void abortUnion()Description copied from interface:Union
Force the use of a series of standard selects rather than a true UNION.- Specified by:
abortUnion
in interfaceUnion
-
getOrdering
Description copied from interface:Union
Get the union-level ordering, if any.- Specified by:
getOrdering
in interfaceUnion
-
getConfiguration
Description copied from interface:SelectExecutor
Return the select configuration.- Specified by:
getConfiguration
in interfaceSelectExecutor
-
getDBDictionary
-
toSelect
Description copied from interface:SelectExecutor
Return this select as a SQL statement formatted for the current dictionary.- Specified by:
toSelect
in interfaceSelectExecutor
-
getSQL
Description copied from interface:SelectExecutor
Get the buffer if it has been computed by a previous call toSelectExecutor.toSelect(boolean, JDBCFetchConfiguration)
, if any.- Specified by:
getSQL
in interfaceSelectExecutor
-
toSelectCount
Description copied from interface:SelectExecutor
Return this select as a COUNT SQL statement formatted for the current dictionary.- Specified by:
toSelectCount
in interfaceSelectExecutor
-
getAutoDistinct
public boolean getAutoDistinct()Description copied from interface:SelectExecutor
Whether to automatically make results distinct when relational joins would otherwise introduce duplicates.- Specified by:
getAutoDistinct
in interfaceSelectExecutor
-
setAutoDistinct
public void setAutoDistinct(boolean distinct) Description copied from interface:SelectExecutor
Whether to automatically make results distinct when relational joins would otherwise introduce duplicates.- Specified by:
setAutoDistinct
in interfaceSelectExecutor
-
isDistinct
public boolean isDistinct()Description copied from interface:SelectExecutor
Whether this is a SELECT DISTINCT / UNION ALL.- Specified by:
isDistinct
in interfaceSelectExecutor
-
setDistinct
public void setDistinct(boolean distinct) Description copied from interface:SelectExecutor
Whether this is a SELECT DISTINCT / UNION ALL.- Specified by:
setDistinct
in interfaceSelectExecutor
-
isLRS
public boolean isLRS()Description copied from interface:SelectExecutor
Whether the result of this select should be treated as a large result set.- Specified by:
isLRS
in interfaceSelectExecutor
-
setLRS
public void setLRS(boolean lrs) Description copied from interface:SelectExecutor
Whether the result of this select should be treated as a large result set.- Specified by:
setLRS
in interfaceSelectExecutor
-
getExpectedResultCount
public int getExpectedResultCount()Description copied from interface:SelectExecutor
The expected result count for the query.- Specified by:
getExpectedResultCount
in interfaceSelectExecutor
-
setExpectedResultCount
public void setExpectedResultCount(int expectedResultCount, boolean force) Description copied from interface:SelectExecutor
The expected result count for the query.- Specified by:
setExpectedResultCount
in interfaceSelectExecutor
force
- 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:SelectExecutor
The join syntax for this select, as one of the syntax constants fromJoinSyntaxes
.- Specified by:
getJoinSyntax
in interfaceSelectExecutor
-
setJoinSyntax
public void setJoinSyntax(int syntax) Description copied from interface:SelectExecutor
The join syntax for this select, as one of the syntax constants fromJoinSyntaxes
.- Specified by:
setJoinSyntax
in interfaceSelectExecutor
-
supportsRandomAccess
public boolean supportsRandomAccess(boolean forUpdate) Description copied from interface:SelectExecutor
Return whether this select can support a random access result set type.- Specified by:
supportsRandomAccess
in interfaceSelectExecutor
-
supportsLocking
public boolean supportsLocking()Description copied from interface:SelectExecutor
Whether this select can be executed for update.- Specified by:
supportsLocking
in interfaceSelectExecutor
-
hasMultipleSelects
public boolean hasMultipleSelects()Description copied from interface:SelectExecutor
Affirm if this receiver requires more than one selects to fetch its data.- Specified by:
hasMultipleSelects
in interfaceSelectExecutor
-
getCount
Description copied from interface:SelectExecutor
Return the number of instances matching this select.- Specified by:
getCount
in interfaceSelectExecutor
- Throws:
SQLException
-
execute
Description copied from interface:SelectExecutor
Execute this select in the context of the given store manager.- Specified by:
execute
in interfaceSelectExecutor
- Throws:
SQLException
-
execute
public Result execute(JDBCStore store, JDBCFetchConfiguration fetch, int lockLevel) throws SQLException Description copied from interface:SelectExecutor
Execute this select in the context of the given store manager.- Specified by:
execute
in interfaceSelectExecutor
- Throws:
SQLException
-
select
Description copied from interface:Union
Select data using the given selector. -
toString
-