SQLRepository
classin packageklyn.data.sql
public class SQLRepository<T, TId> implements Repository<T, TId>:
SQLRepository
All Implemented Interfaces: Repository

Read-only, no-tracking repository over one mapped SQL table or view.

Direct repositories open one connection per execution. Repositories owned by an EntityManager borrow its lazily opened session connection, allowing transaction continuity without changing this public repository contract. Application values are always bound parameters and never concatenated into SQL text.

Example
users = SQLRepository<User, Int>(configuration)
active = query:
from users user
where user.active
Properties
Modifier and Type Member Description
public readonly property configuration
configuration as SQLConfiguration
Immutable provider configuration.
public readonly property mapping
mapping as SQLMapping<T, TId>
Validated entity mapping resolved once at construction.
Constructors
Modifier and Type Member Description
public SQLRepository
SQLRepository( configuration as SQLConfiguration, mapping as SQLMapping<T, TId>, session as SQLProviderSession, tracker as SQLIdentityTracker ):
Creates a repository borrowing one EntityManager SQL session.
public SQLRepository
SQLRepository(configuration as SQLConfiguration):
Creates a direct no-tracking repository with an inferred SQL mapping.
public SQLRepository
SQLRepository(configuration as SQLConfiguration, mapping as SQLMapping<T, TId>):
Creates a direct no-tracking repository with an explicit mapping.
Methods
Modifier and Type Member Description
public asQuery
asQuery() as Query<T>:
Returns a lazy identity query over this SQL repository.
public count
count() as Long:
Returns the exact number of mapped source entities.
public countPlan
countPlan(plan as QueryPlanBase) as Long:
Executes an exact SQL-side count over the canonical result window.
public executePlan
executePlan(plan as QueryPlanBase) as Object:
Executes one canonical plan into its concrete specialized result list.
public existsPlan
existsPlan(plan as QueryPlanBase) as Boolean:
Executes a one-row SQL existence probe.
public openStream
openStream(plan as QueryPlanBase) as Object:
Opens a true cursor-backed stream with independent provider resources.
public providerName
providerName() as String:
Returns the stable SQL provider identifier.
public providerText
providerText(plan as QueryPlanBase) as String:
Returns rendered SQL without exposing bound parameter values.
public validateBeforeRead
validateBeforeRead() as Repository<T, TId>:
Validates null and duplicate identities before subsequent reads.
Inherited Methods
methodInherited Methods from Repository: count, validateBeforeRead
methodInherited Methods from Queryable: asQuery
methodInherited Methods from QuerySource: countPlan, executePlan, existsPlan, openStream, providerName, providerText