Implementation:APIJSON APIJSON AbstractSQLConfig concatJoinWhereString
| Knowledge Sources | |
|---|---|
| Domains | ORM, SQL_Generation, SQL_Join |
| Last Updated | 2026-10-11 00:00 GMT |
Overview
Concrete SQL clause generator that combines the main table's WHERE clause with join table outer conditions, producing the complete WHERE string for SQL JOIN queries, provided by the APIJSON ORM framework.
Description
The concatJoinWhereString' method on AbstractSQLConfig merges the main table's WHERE conditions with each join's outer config conditions. For each join in the joinList:
- CROSS JOIN (*) and APP JOIN (@): treated with AND logic
- LEFT JOIN (<): main WHERE + outer WHERE with AND
- RIGHT JOIN (>): main WHERE + outer WHERE with OR
- INNER JOIN (&): main WHERE + outer WHERE with AND
- FULL JOIN (|): main WHERE + outer WHERE with OR
- OUTER JOIN (!): main WHERE + outer WHERE with NOT
- SIDE JOIN (^): main WHERE + outer WHERE with OR
- ANTI JOIN ((): main WHERE + outer WHERE with NOT
The method also merges prepared-statement value lists from the outer configs into the main prepared value list.
Usage
Called internally by getWhereString() after the main WHERE clause is generated. Not typically called directly.
Code Reference
Source Location
- Repository: APIJSON
- File: src/main/java/apijson/orm/AbstractSQLConfig.java
Signature
protected String concatJoinWhereString(String whereString) throws Exception
Parameters:
- whereString - The main table's WHERE clause string (without WHERE prefix)
Returns: String - Combined WHERE clause with join conditions
Import
import apijson.orm.AbstractSQLConfig;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| whereString | String | Yes | Main table WHERE clause |
| joinList | List<Join> | Yes | Join configurations with outerConfig |
| isPrepared | boolean | Yes | Whether using prepared statements |
Outputs
| Name | Type | Description |
|---|---|---|
| return | String | Combined WHERE clause with join conditions |
| preparedValueList | List<Object> | Updated with outer config prepared values |
Usage Examples
LEFT JOIN WHERE Combination
// Main WHERE: "id > 0"
// Join: LEFT JOIN User with outer WHERE: "name LIKE 'Tom%'"
// Logic for LEFT JOIN: AND
// Result: "( ( id > 0 AND ( name LIKE 'Tom%' ) ) )"
// Full SQL: SELECT ... FROM Moment LEFT JOIN User ON ... WHERE ( ( id > 0 AND ( name LIKE 'Tom%' ) ) )
INNER JOIN WHERE Combination
// Main WHERE: "userId = 82001"
// Join: INNER JOIN Comment with outer WHERE: "content LIKE 'Hello%'"
// Logic for INNER JOIN: AND
// Result: "( ( userId = 82001 AND ( content LIKE 'Hello%' ) ) )"