Class JoinedSelect<T extends PersistentDomainObject<T>>
java.lang.Object
org.tentackle.persist.JoinedSelect<T>
- Type Parameters:
T- the primary PDO type
A joined
SELECT.
Holds the Joins of a query along with the state of the running query,
i.e., the PDOs retrieved so far. Hence, a joined select is created per query and
must not be shared between threads.
- Author:
- harald
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a joinedSELECT.JoinedSelect(List<Join<? super T, ?>> joins) Creates a joinedSELECTfrom a list of joins. -
Method Summary
Modifier and TypeMethodDescriptionAdds a join.voidcreateJoinedSql(T pdo, StringBuilder selectSql) Appends the joins to the SQL code of the select.Gets the currently retrieved PDO.getJoins()Gets the joins.Gets the state of the joins for this select.Gets the PDO retrieved before the current PDO.voidinitialize(List<T> list) Initializes the joined select.
Must be invoked before each query.Finishes the current PDO and switches to the next.
When selecting into a list, a PDO already in the list is reused.
-
Constructor Details
-
JoinedSelect
public JoinedSelect()Creates a joinedSELECT. -
JoinedSelect
-
-
Method Details
-
addJoin
Adds a join.- Parameters:
join- the join- Returns:
- me (to allow fluent style setup)
-
getJoins
-
getJoinState
Gets the state of the joins for this select.- Returns:
- the join state, never null
-
createJoinedSql
Appends the joins to the SQL code of the select.- Parameters:
pdo- the PDO proxyselectSql- the select builder without joins, appended with the joins on return- Throws:
org.tentackle.session.PersistenceException- if a join type is neither INNER nor LEFT
-
getLastPdo
Gets the PDO retrieved before the current PDO.- Returns:
- the last PDO, null if none
-
currentPdo
-
nextPdo
-
initialize
-