SAIF.Data.NHibernate architecture¶
SAIF.Data.NHibernate is the persistence infrastructure for SAIF.Data's entity models: 388 compiled FluentNHibernate ClassMaps over roughly 367 distinct tables (mostly Oracle, plus one SQL Server procedure), 11 custom NHibernate user types, and a set of specialized repositories that implement the repository interfaces declared in SAIF.Data (saif-data-nhibernate-analysis.md).
Responsibilities¶
- Map SAIF.Data entities to their underlying tables through FluentNHibernate
ClassMap<T>/SubclassMap<T>declarations, discovered by assembly scanning. - Define embedded
.hbm.xmlnamed queries (24 defined, 21 used) and inlineCreateSqlQuerycalls (6) that invoke OracleWCIS_DBAPL/SQL packages and one SQL Server stored procedure. - Implement custom
IUserTypeconversions for tri-state flags and coded enumerations underCustomTypes/. - Implement 12 specialized repositories (
ClaimBillEntryRepository,CollectionsRepository,PoliciesRepository,PolicyPeriodPayrollAuditRepository,ProvidersRepository,ClaimScoreRepository,MissingTimeLossRepository,GroupImageRepository,GroupRepository,ImageCategoryCodeRepository,InvestigationRepositoryExtensions,PolicyOutputDocumentRepository/PolicyOutputDocumentExtensions) that layer domain-specific queries over the external unit-of-work infrastructure.
Component boundaries¶
Mappings/: approximately 390 compiled ClassMap files (388 producing ClassMaps, 13 without aTable()for named-query result mapping) plus 5 embedded.hbm.xmlfiles holding only<sql-query>named queries and their result mappings.CustomTypes/: 11IUserTypeimplementations, includingYesNoNullUserTypeand the certificate/claim-authority enumerations.Repositories/: the 12 specialized repository classes and extension sets listed above, grouped underGroups/,Imaging/,Investigations/, andOutputDocuments/sub-namespaces.
Interaction model¶
This library has no ISessionFactory construction, no Fluently.Configure(), no connection string, and no ContainerBuilder; session and transaction management are fully delegated to the external SAIF.Framework.Data.NHibernate package (NHibernateUnitOfWork, OracleUnitOfWorkFactory, OracleConfigurationFactory). Consuming applications supply this assembly as the mapping source to the framework's configuration factory — for example DependencyMaps/SAIF.DependencyMaps.Web.OnlineSupport/DependencyMap.cs passes typeof(ErrorLogMap).Assembly. Repositories receive NHibernateUnitOfWork (or IUnitOfWork for ProvidersRepository) by constructor injection and execute LINQ, named queries, or inline SQL. ClaimBillEntryRepository is a notable exception: it no longer uses its embedded named queries and instead delegates bill-queue processing to SAIF.Data's Guidewire-backed ICCClaimApiService (saif-data-nhibernate-analysis.md Architecture findings).
Architecture diagram¶
The following diagram shows how consumers reach the mapped Oracle/SQL Server data through this library's repositories, and the one operation that now bypasses the database entirely.
flowchart TD
Consumer["SAIF.Services /<br>DependencyMaps"] --> Framework["SAIF.Framework.Data.NHibernate<br>session factory / NHibernateUnitOfWork"]
Framework --> Repos["Specialized repositories<br>(Collections, Policies, GroupImage, etc.)"]
Repos --> Maps["FluentNHibernate ClassMaps<br>(388 maps, ~367 tables)"]
Maps --> Oracle["Oracle WCIS_DBA<br>packages and tables"]
Repos --> SqlServer["SQL Server<br>bp_clm_segmntn_complexity_score"]
Repos --> CCApi["SAIF.Data<br>ICCClaimApiService (bill queue)"]
Sequence diagram¶
The following diagram shows collection payment application, a write path that calls an Oracle package directly (OP-SDN-04).
sequenceDiagram
participant Caller as SAIF.Services caller
participant Repo as CollectionsRepository
participant UoW as NHibernateUnitOfWork
participant Oracle as Oracle WCIS_DBA package
Caller->>Repo: ApplyPayments(caseSeqNum, paymentDate)
Repo->>UoW: CreateSqlQuery(call WCIS_DBA.PK80010_LEGAL_COLLECTIONS.APPLYPAYMENTS)
UoW->>Oracle: ExecuteUpdate()
Oracle-->>UoW: Rows affected
UoW-->>Repo: Result
Repo-->>Caller: Completed ([SDN-BR-010](business-rules.md#sdn-br-010-collection-case-payments-are-applied-by-the-oracle-package-applypayments-for-the-case-and-payment-date))
Design constraints¶
- Session, transaction, and connection-string management are entirely external to this library, provided by
SAIF.Framework.Data.NHibernateand configured by the consuming application (saif-data-nhibernate-analysis.mdArchitecture findings)*. - Two database engines are in play: Oracle for almost all maps, plus one SQL Server stored procedure (
bp_clm_segmntn_complexity_score) forClaimScoreRepository, which requires consumers to configure a second, unseen session factory (saif-data-nhibernate-analysis.mdOpen questions item 2)**. GroupImageRepository.GetFilteredImageGroups's deleted-image filter (ImageDeleteCode != null || canSeeDeleted) is logically inverted relative to the project's deletion convention, an authorization bypass for deleted group images (SC-SDN-01, High severity,saif-data-nhibernate-security-analysis.md).- The Edi maps bind to the personal Oracle schema
OPS$JIMMIL, a least-privilege and portability concern (SC-SDN-04)*. ClaimBillEntryRepository's legacy named queries (ClaimBillEntry_GetNextBillFromQueue,ClaimBillEntry_RestoreBillToQueue) are defined but unused; bill-queue processing now delegates toSAIF.Data's Guidewire-backedCCClaimApiService(SDN-BR-001).CollectionsRepository.GetDebtorSsnandSearchCollectionshandle debtor SSNs (PII) with no access check at this layer; callers must restrict access themselves (SC-SDN-03)*.PolicyOutputDocumentExtensionsis duplicated acrossSAIF.DataandSAIF.Data.NHibernatewith divergent members, risking ambiguity when both namespaces are imported (saif-data-nhibernate-analysis.mdOpen questions item 9).
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with**could not be confirmed; treat as unknown until verified.
Related documentation¶
- Index
- Overview
- Dependencies
- Operations and processes
- Business rules
- Database tables
- SQL catalog
- Procedures
- Security and authorization
- API reference
Sources¶
Data/SAIF.Data.NHibernate/SAIF.Data.NHibernate.csprojData/SAIF.Data.NHibernate/Repositories/ClaimBillEntryRepository.csData/SAIF.Data.NHibernate/Repositories/CollectionsRepository.csData/SAIF.Data.NHibernate/Repositories/Claims/Information/ClaimScoreRepository.csData/SAIF.Data.NHibernate/Repositories/Groups/GroupImageRepository.csData/SAIF.Data.NHibernate/Mappings/Claims/Bills/ClaimBillEntry.hbm.xmlData/SAIF.Data.NHibernate/Mappings/Claims/Information/ClaimsAnalytics.hbm.xmlData/SAIF.Data.NHibernate/Mappings/Collections/Collections.hbm.xmlData/SAIF.Data.NHibernate/Mappings/Edi/EdiElementMap.csDependencyMaps/SAIF.DependencyMaps.Web.OnlineSupport/DependencyMap.cs