Entity Properties - fieldenms/tg GitHub Wiki

Entity Properties

Key

Composite Key

Composite key -- property key with type DynamicEntityKey. Its nature is that of a calculated property. Its string representation is a concatenation of values for all key member properties, separated by the specified separator ( by default).

One-to-one Association Properties

Property P declared by entity E represents a one-to-one association if:

  • P is of an entity type PE.
  • PE has key type K and K <= E (in terms of subtyping) and (K is persistent or synthetic-based-on-persistent).

Example:

@KeyType(String.class)
class Vehicle extends AbstractPersistentEntity<String> {
  // one-to-one association
  @IsProperty VehicleDetails details;
}

@KeyType(Vehicle.class)
class VehicleDetails extends AbstractPersistentEntity<Vehicle> {}

Here, property Vehicle.details is implicitly calculated. The value of Vehicle.details for any given Vehicle v will be calculated to find the VehicleDetails associated with v, if such an association indeed exists (thus, Vehicle.details is also nullable).

Specifically, the EQL expression for Vehicle.details will be the following:

select(VehicleDetails.class).where().prop("key").eq().extProp("id").model()

See also

⚠️ **GitHub.com Fallback** ⚠️