Skip to main content
Subsets are defined in the subsets object within Entity JSON files.

Basic Subset Definition

Entity Structure

Subset definition example in Entity

Subset Definition Rules

Selecting Relation Fields

OneToOne Relations

OneToOne relations are automatically LEFT JOINed. Selecting employee.id will join the employees table.

Nested Relations (2+ Levels)

SQL Result:
Hydrate Result:

Subset Naming Strategy

General Conventions

Subset naming conventions

Domain-Specific Subsets

Naming Tips: - Use short, clear names (A, L, P, etc.) - Maintain consistent conventions within your team - Can use meaningful domain-specific names

Subset Design Principles

1. Minimum Fields Principle

2. Separate by Purpose

3. Performance Considerations

Performance Tips: - Minimize JOINs (only needed relations) - Use L Subset for list views (exclude relations) - Use P Subset only for detail views (include relations)
Subset performance comparison

Practical Example

User Entity

Code Generation

When you define Subsets, types are automatically generated:
After changing Subsets, you must run Code Generation. This updates the TypeScript types.
Generated Types:
Generated TypeScript types

Next Steps

Using Subsets

Use Subsets in Model

Nested Relations

Load 1:N with LoaderQuery

Entity Definition

Understanding Entity structure

Code Generation

Automatic code generation