PanacheCompanionBase

Defines methods to be used via the companion objects of entities.

Parameters

Entity

the entity type

Functions

Link copied to clipboard
@GenerateBridge
open fun count(): Long

Counts the number of this type of entity in the database.

@GenerateBridge
open fun count(query: String, params: Parameters): Long
@GenerateBridge
open fun count(query: String, params: Map<String, Any>): Long

Counts the number of this type of entity matching the given query, with named parameters.

@GenerateBridge
open fun count(query: String, vararg params: Any): Long

Counts the number of this type of entity matching the given query, with optional indexed parameters.

Link copied to clipboard
@GenerateBridge
open fun delete(query: String, params: Parameters): Long
@GenerateBridge
open fun delete(query: String, params: Map<String, Any>): Long

Delete all entities of this type matching the given query, with named parameters.

@GenerateBridge
open fun delete(query: String, vararg params: Any): Long

Delete all entities of this type matching the given query, with optional indexed parameters.

Link copied to clipboard
@GenerateBridge
open fun deleteAll(): Long

Delete all entities of this type from the database.

Link copied to clipboard
@GenerateBridge
open fun deleteById(id: Id): Boolean

Delete an entity of this type by ID.

Link copied to clipboard
@GenerateBridge
open fun find(query: String, params: Parameters): PanacheQuery<Entity>
@GenerateBridge
open fun find(query: String, params: Map<String, Any>): PanacheQuery<Entity>

Find entities using a query, with named parameters.

@GenerateBridge
open fun find(query: String, vararg params: Any): PanacheQuery<Entity>

Find entities using a query, with optional indexed parameters.

@GenerateBridge
open fun find(query: String, sort: Sort, params: Parameters): PanacheQuery<Entity>
@GenerateBridge
open fun find(query: String, sort: Sort, params: Map<String, Any>): PanacheQuery<Entity>

Find entities using a query and the given sort options, with named parameters.

@GenerateBridge
open fun find(query: String, sort: Sort, vararg params: Any): PanacheQuery<Entity>

Find entities using a query and the given sort options with optional indexed parameters.

Link copied to clipboard
@GenerateBridge
open fun findAll(): PanacheQuery<Entity>

Find all entities of this type.

@GenerateBridge
open fun findAll(sort: Sort): PanacheQuery<Entity>

Find all entities of this type, in the given order.

Link copied to clipboard
@GenerateBridge(targetReturnTypeErased = true)
open fun findById(id: Id): Entity?

Find an entity of this type by ID.

@GenerateBridge(targetReturnTypeErased = true)
open fun findById(id: Id, lockModeType: LockModeType): Entity?

Find an entity of this type by ID and lock it.

Link copied to clipboard
@GenerateBridge(targetReturnTypeErased = true)
open fun flush()

Flushes all pending changes to the database.

Link copied to clipboard
@GenerateBridge
open fun getEntityManager(): EntityManager

Returns the EntityManager for the Entity for extra operations (eg. CriteriaQueries)

Link copied to clipboard
@GenerateBridge
open fun list(query: String, params: Parameters): List<Entity>
@GenerateBridge
open fun list(query: String, params: Map<String, Any>): List<Entity>

Find entities matching a query, with named parameters. This method is a shortcut for find(query, params).list().

@GenerateBridge
open fun list(query: String, vararg params: Any): List<Entity>

Find entities matching a query, with optional indexed parameters. This method is a shortcut for find(query, params).list().

@GenerateBridge
open fun list(query: String, sort: Sort, params: Parameters): List<Entity>
@GenerateBridge
open fun list(query: String, sort: Sort, params: Map<String, Any>): List<Entity>

Find entities matching a query and the given sort options, with named parameters. This method is a shortcut for find(query, sort, params).list().

@GenerateBridge
open fun list(query: String, sort: Sort, vararg params: Any): List<Entity>

Find entities matching a query and the given sort options, with optional indexed parameters. This method is a shortcut for find(query, sort, params).list().

Link copied to clipboard
@GenerateBridge
open fun listAll(): List<Entity>

Find all entities of this type. This method is a shortcut for findAll().list().

@GenerateBridge
open fun listAll(sort: Sort): List<Entity>

Find all entities of this type, in the given order. This method is a shortcut for findAll(sort).list().

Link copied to clipboard
open fun persist(entities: Stream<Entity>)
open fun persist(entities: Iterable<Entity>)
open fun persist(firstEntity: Entity, vararg entities: Entity)

Persist all given entities.

Link copied to clipboard
@GenerateBridge
open fun stream(query: String, params: Parameters): Stream<Entity>
@GenerateBridge
open fun stream(query: String, params: Map<String, Any>): Stream<Entity>

Find entities matching a query, with named parameters. This method is a shortcut for find(query, params).stream(). It requires a transaction to work. Without a transaction, the underlying cursor can be closed before the end of the stream.

@GenerateBridge
open fun stream(query: String, vararg params: Any): Stream<Entity>

Find entities matching a query, with optional indexed parameters. This method is a shortcut for find(query, params).stream(). It requires a transaction to work. Without a transaction, the underlying cursor can be closed before the end of the stream.

@GenerateBridge
open fun stream(query: String, sort: Sort, params: Parameters): Stream<Entity>
@GenerateBridge
open fun stream(query: String, sort: Sort, params: Map<String, Any>): Stream<Entity>

Find entities matching a query and the given sort options, with named parameters. This method is a shortcut for find(query, sort, params).stream(). It requires a transaction to work. Without a transaction, the underlying cursor can be closed before the end of the stream.

@GenerateBridge
open fun stream(query: String, sort: Sort, vararg params: Any): Stream<Entity>

Find entities matching a query and the given sort options, with optional indexed parameters. This method is a shortcut for find(query, sort, params).stream(). It requires a transaction to work. Without a transaction, the underlying cursor can be closed before the end of the stream.

Link copied to clipboard
@GenerateBridge
open fun streamAll(): Stream<Entity>

Find all entities of this type. This method is a shortcut for findAll().stream(). It requires a transaction to work. Without a transaction, the underlying cursor can be closed before the end of the stream.

@GenerateBridge
open fun streamAll(sort: Sort): Stream<Entity>

Find all entities of this type, in the given order. This method is a shortcut for findAll(sort).stream(). It requires a transaction to work. Without a transaction, the underlying cursor can be closed before the end of the stream.

Link copied to clipboard
@GenerateBridge
open fun update(query: String, params: Parameters): Int
@GenerateBridge
open fun update(query: String, params: Map<String, Any>): Int

Update all entities of this type matching the given query, with named parameters.

@GenerateBridge
open fun update(query: String, vararg params: Any): Int

Update all entities of this type matching the given query, with optional indexed parameters.

Inheritors

Link copied to clipboard