java.lang.Object
org.litebridgedb.orm.api.register.OneToManyBuilder
Builder class for defining one-to-many relationships between a field or property in a DTO (Data Transfer Object)
and a corresponding set of related records in a database.
This class is part of the Litebridge ORM's fluent API for registering mappings between DTOs and database tables. It provides methods to specify one-to-many relationships, either by field-based or property-based access, and is primarily designed for use in the context of table registration and ORM configuration.
Methods in this class return instances of OneToMany, which encapsulate the details of the one-to-many mapping.
A OneToMany instance includes a FieldSpec, representing the specific field or property in the DTO
that maps to the related database records.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionmappedByField(String field) Defines a one-to-many relationship between a specified field in a DTO (Data Transfer Object) and a corresponding collection of rows in a database table.mappedByProperty(String property) Defines a one-to-many relationship based on a specified property in a DTO (Data Transfer Object).
-
Constructor Details
-
OneToManyBuilder
public OneToManyBuilder()
-
-
Method Details
-
mappedByField
Defines a one-to-many relationship between a specified field in a DTO (Data Transfer Object) and a corresponding collection of rows in a database table.- Parameters:
field- The name of the field in the DTO that represents the one-to-many relationship. This should match the field's name in the DTO and will be used for field-level access.- Returns:
- An
OneToManyinstance encapsulating the relationship details based on the provided field specification.
-
mappedByProperty
Defines a one-to-many relationship based on a specified property in a DTO (Data Transfer Object). This method creates aOneToManyinstance that represents the mapping of a property in the DTO to a collection of related records in a database table. The property access is based on getter/setter conventions.- Parameters:
property- The name of the property in the DTO that represents the one-to-many relationship. This should match the property name as defined by the getter/setter in the DTO.- Returns:
- An
OneToManyinstance encapsulating the relationship details based on the provided property specification.
-