OneToMany class
OneToMany relationship annotation
Defines a one-to-many relationship between entities. This is the owning side - a FK column will be created in the target entity's table. The FK column name is automatically derived as {ownerEntity}_id (snake_case).
Example:
// In UserEntity - owns the relationship
// Automatically creates user_id FK column in posts table
@OneToMany(targetEntity: PostEntity)
List<PostEntity>? posts;
Constructors
- OneToMany({required Type targetEntity, bool cascadeDelete = false, bool lazyLoad = true, bool eagerLoad = false, RelationAction onDelete = RelationAction.noAction, RelationAction onUpdate = RelationAction.noAction})
-
const
Properties
- cascadeDelete → bool
-
Whether to cascade delete operations
final
- eagerLoad → bool
-
Whether to eager load the relationship
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- lazyLoad → bool
-
Whether to lazy load the relationship
final
- onDelete → RelationAction
-
Action to take on delete of this entity
final
- onUpdate → RelationAction
-
Action to take on update of this entity
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- targetEntity → Type
-
The target entity type for this relationship
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited