klyn.data.EntityManager.persist
method

    public persist<T>(entity as T) as Void:

Description

Registers a new entity for insertion.

The entity becomes managed immediately, but SQL is emitted only by `saveChanges()`, an automatic flush, or transaction commit.

Parameters

Parameter | Description
--- | ---
`<T>` | Entity type.
`entity` | New entity instance.

Throws

- EntityExistsException when a generated identity is already set or another instance with the same identity is managed.
- ProviderCapabilityException for read-only providers.

Example

    manager.persist(User(login="alice"))