---
title: "SQL-118: Retrieve CbpBillEntrySourceCode via CreateNewBill"
summary: Read operation against CbpBillEntrySourceCode via NHibernate ORM.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# SQL-118: Retrieve CbpBillEntrySourceCode via CreateNewBill

This ORM statement performs a read operation on `CbpBillEntrySourceCode` via `IUnitOfWork.GetRepository<T>()`, executed from `Services/SAIF.Services/Claims/Bills/BillEntryService.cs (L393)`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-118 |
| **Operation type** | Read |
| **Execution method** | ORM (NHibernate LINQ) |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `CbpBillEntrySourceCode` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `CreateNewBill` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `CbpBillEntrySourceCode.CBE` | Input | ** | N/A | `x.Code == CbpBillEntrySourceCode.CBE` → column CODE |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [CBP_BILL_ENTRY_SOURCE_CODE](../database-tables.md#cbp_bill_entry_source_code) | SELECT | `CODE`, `UPDATE_NUM`, `CODE_DESCR`, `UPDATE_USER`, `UPDATE_DATE` |

## LINQ statement

Source: `Services/SAIF.Services/Claims/Bills/BillEntryService.cs:393`

```csharp
// Services/SAIF.Services/Claims/Bills/BillEntryService.cs:393
                BillEntrySource = unitOfWork.GetRepository<CbpBillEntrySourceCode>().Query().SingleOrDefault(x => x.Code == CbpBillEntrySourceCode.CBE)
```

## 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.

```sql
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
-- Services/SAIF.Services/Claims/Bills/BillEntryService.cs:393
SELECT
  CBESC.CODE,
  CBESC.UPDATE_NUM,
  CBESC.CODE_DESCR,
  CBESC.UPDATE_USER,
  CBESC.UPDATE_DATE
FROM CBP_BILL_ENTRY_SOURCE_CODE CBESC
WHERE CBESC.CODE = 'C'
-- NHibernate expects at most one row
```

Translation notes:
- `CbpBillEntrySourceCode.CBE` is the constant `"C"` (Data/SAIF.Data/Model/Claims/Bills/CbpBillEntrySourceCode.cs:7) -> inline literal.

## Operations and processes
- BillEntryService.CreateNewBill — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Claims/Bills/BillEntryService.cs (L393)`
