PanacheEntity

@MappedSuperclass
open class PanacheEntity : PanacheEntityBase

Represents an entity with a generated ID field id of type Long. If your Hibernate entities extend this class they gain the ID field and auto-generated accessors to all their public fields (unless annotated with Transient), as well as all the useful methods from PanacheEntityBase.

If you want a custom ID type or strategy, you can directly extend PanacheEntityBase instead, and write your own ID field. You will still get auto-generated accessors and all the useful methods.

See also

Constructors

Link copied to clipboard

Functions

Link copied to clipboard
open fun delete()

Delete this entity from the database, if it is already persisted.

Link copied to clipboard
open fun isPersistent(): Boolean

Returns true if this entity is persistent in the database. If yes, all modifications to its persistent fields will be automatically committed to the database at transaction commit time.

Link copied to clipboard
open fun persist()

Persist this entity in the database, if not already persisted. This will set your ID field if it is not already set.

Link copied to clipboard
open fun persistAndFlush()

Persist this entity in the database, if not already persisted. This will set your ID field if it is not already set. Then flushes all pending changes to the database.

Link copied to clipboard
open override fun toString(): String

Default toString() implementation

Properties

Link copied to clipboard
open var id: Long? = null

The auto-generated ID field. This field is set by Hibernate ORM when this entity is persisted.