persist(entity) {
    if (!(entity instanceof AbstractEntity)) {
      throw new TypeError("The entity must be an AbstractEntity instance")
    }
    validateEntityClass(entity.constructor)

    if (this[PRIVATE.activeTransaction]) {
      return this[PRIVATE.activeTransaction].persist(entity)
    }

    return this.runTransaction((transaction) => {
      return transaction.persist(entity)
    }).then(() => entity)
  }
/**
   * Creates the provided entity in the database. If the entity does not have
   * its primary key set and the entity's object store generates primary keys
   * for new records automatically, the entity will have its primary key set
   * when this operation completes.
   *
   * The created entity will be managed by this entity manager for the duration
   * of the current transaction.
   *
   * @template {T} extends AbstractEntity
   * @param {T} entity The entity to create in the database.
   * @return {Promise<T>} A promise that resolves when the entity has been
   *         saved. The promise will resolve to the saved entity.
   */
Creates the provided entity in the database. If the entity does not have
its primary key set and the entity's object store generates primary keys
for new records automatically, the entity will have its primary key set
when this operation completes.

The created entity will be managed by this entity manager for the duration
of the current transaction.

@template {T} extends AbstractEntity
@param {T} entity The entity to create in the database.
@return {Promise} A promise that resolves when the entity has been
saved. The promise will resolve to the saved entity.
Creates the provided entity in the database . If the entity does not have its primary key set and the entity ' s object store generates primary keys for new records automatically the entity will have its primary key set when this operation completes . The created entity will be managed by this entity manager for the duration of the current transaction . @template { T } extends AbstractEntity @param { T } entity The entity to create in the database . @return { Promise } A promise that resolves when the entity has been saved . The promise will resolve to the saved entity .
persist(entity) {
    if (!(entity instanceof AbstractEntity)) {
      throw new TypeError("The entity must be an AbstractEntity instance")
    }
    validateEntityClass(entity.constructor)
    if (this[PRIVATE.activeTransaction]) {
      return this[PRIVATE.activeTransaction].persist(entity)
    }
    return this.runTransaction((transaction) => {
      return transaction.persist(entity)
    }).then(() => entity)
  }
persist ( entity ) { if ( ! ( entity instanceof AbstractEntity ) ) { throw new TypeError ( "The entity must be an AbstractEntity instance" ) } validateEntityClass ( entity . constructor ) if ( this [ PRIVATE . activeTransaction ] ) { return this [ PRIVATE . activeTransaction ] . persist ( entity ) } return this . runTransaction ( ( transaction ) => { return transaction . persist ( entity ) } ) . then ( ( ) => entity ) }
Creates the provided entity in the database.
Creates the provided entity in the database .