← Back to Stormify Documentation

AutoTable

abstract class AutoTable : StormifyEntity

Base class for entities that support auto-hydration from the database.

Two ways an AutoTable comes to life:

  • User-constructed (Entity() in user code, possibly via apply { id = … }): the entity is considered already in a usable state. Reading or writing a property delegated via db never triggers a DB round-trip. The user is in control: if they want DB values, they call Stormify.refresh (or use findById).

  • Library-constructed shadow reference (the FK stub the library creates when it loads a parent that points to this row): on the first read or write of any db-delegated property, the row is auto-loaded by the library, filling every field; then the original operation proceeds.

When multiple shadows share the same SiblingGroup, they are batch-loaded in a single query.

Subclasses that hand-write getters/setters (typically Java code) can call hydrate to implement the same at-most-once lazy-load pattern that the Kotlin db delegate applies automatically.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

Marks this entity as already hydrated, preventing any future auto-load by the db delegate.