SQL-164: LegalQueryProvider.GetLegalPersonAddress¶
This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by LegalQueryProvider.GetLegalPersonAddress.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-164 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| Database | Oracle* |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | LegalQueryProvider |
| Criteria property | N/A — ORM |
| Lifecycle method | GetLegalPersonAddress |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
id |
Input | long | N/A | Method argument of LegalQueryProvider.GetLegalPersonAddress bound into the ORM expression; NHibernate generates the bind variable at runtime |
addressTypeCode |
Input | string | N/A | Method argument of LegalQueryProvider.GetLegalPersonAddress bound into the ORM expression; NHibernate generates the bind variable at runtime |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| LEGAL_PERSON_ADDRESS | SELECT | LEGAL_PERSON_SEQ_NUM, ADDRESS1, ADDRESS2, CITY, STATE, ZIP, ZIP4, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE, ADDRESS_TYPE_CODE |
LINQ statement¶
Source: Data/SAIF.Data/Queries/Legal/LegalQueryProvider.cs:128.
public LegalPersonAddress GetLegalPersonAddress(long id, string addressTypeCode)
{
return Factory.GetRepository<LegalPersonAddress>().Query().FirstOrDefault(x => x.LegalPerson.Id == id && x.AddressType.Code == addressTypeCode);
}
Sample SQL¶
Inferred SQL: This SQL was inferred from the LINQ statement above and the NHibernate mappings. It is not concrete SQL from source code; NHibernate generates the executed statement at runtime, so aliases, column order, join syntax, and bind-parameter names may differ.
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
SELECT * FROM (
SELECT
LPA.LEGAL_PERSON_SEQ_NUM,
LPA.ADDRESS1,
LPA.ADDRESS2,
LPA.CITY,
LPA.STATE,
LPA.ZIP,
LPA.ZIP4,
LPA.CREATE_USER,
LPA.CREATE_DATE,
LPA.UPDATE_USER,
LPA.UPDATE_DATE,
LPA.ADDRESS_TYPE_CODE
FROM LEGAL_PERSON_ADDRESS LPA
WHERE LPA.LEGAL_PERSON_SEQ_NUM = :id
AND LPA.ADDRESS_TYPE_CODE = :addressTypeCode
) WHERE ROWNUM <= 1
Translation notes:
- For a one-to-one with a shared PK, the LegalPerson.Id path resolves to the owner's own identifier column.
Operations and processes¶
Business rules¶
Sources¶
Data/SAIF.Data/Queries/Legal/LegalQueryProvider.cs:128