Class DefaultServer

java.lang.Object
io.ebeaninternal.server.core.DefaultServer
All Implemented Interfaces:
io.ebean.bean.BeanCollectionLoader, io.ebean.Database, io.ebean.plugin.SpiServer, SpiEbeanServer

@NullMarked public final class DefaultServer extends Object implements io.ebean.plugin.SpiServer, SpiEbeanServer
The default server side implementation of EbeanServer.
  • Constructor Details

    • DefaultServer

      public DefaultServer(InternalConfiguration config, io.ebean.cache.ServerCacheManager cache)
      Create the DefaultServer.
  • Method Details

    • executePlugins

      public void executePlugins(boolean online)
      Execute all the plugins with an online flag indicating the DB is up or not.
    • isDisableL2Cache

      public boolean isDisableL2Cache()
      Description copied from interface: SpiEbeanServer
      Return true if the L2 cache has been disabled.
      Specified by:
      isDisableL2Cache in interface SpiEbeanServer
    • log

      public SpiLogManager log()
      Description copied from interface: SpiEbeanServer
      Return the log manager.
      Specified by:
      log in interface SpiEbeanServer
    • isUpdateAllPropertiesInBatch

      public boolean isUpdateAllPropertiesInBatch()
      Description copied from interface: SpiEbeanServer
      Return true if updates in JDBC batch should include all columns if unspecified on the transaction.
      Specified by:
      isUpdateAllPropertiesInBatch in interface SpiEbeanServer
    • lazyLoadBatchSize

      public int lazyLoadBatchSize()
      Description copied from interface: SpiEbeanServer
      Return the default batch size for lazy loading.
      Specified by:
      lazyLoadBatchSize in interface SpiEbeanServer
    • currentTenantId

      public @Nullable Object currentTenantId()
      Description copied from interface: SpiEbeanServer
      Return the current Tenant Id.
      Specified by:
      currentTenantId in interface SpiEbeanServer
    • config

      public io.ebean.DatabaseBuilder.Settings config()
      Specified by:
      config in interface io.ebean.plugin.SpiServer
    • databasePlatform

      public io.ebean.config.dbplatform.DatabasePlatform databasePlatform()
      Specified by:
      databasePlatform in interface io.ebean.plugin.SpiServer
    • script

      public io.ebean.ScriptRunner script()
      Specified by:
      script in interface io.ebean.Database
    • dataTimeZone

      public DataTimeZone dataTimeZone()
      Description copied from interface: SpiEbeanServer
      Return the DataTimeZone to use when reading/writing timestamps via JDBC.
      Specified by:
      dataTimeZone in interface SpiEbeanServer
    • metaInfo

      public io.ebean.meta.MetaInfoManager metaInfo()
      Specified by:
      metaInfo in interface io.ebean.Database
    • platform

      public io.ebean.annotation.Platform platform()
      Specified by:
      platform in interface io.ebean.Database
    • pluginApi

      public io.ebean.plugin.SpiServer pluginApi()
      Specified by:
      pluginApi in interface io.ebean.Database
    • backgroundExecutor

      public io.ebean.BackgroundExecutor backgroundExecutor()
      Specified by:
      backgroundExecutor in interface io.ebean.Database
    • expressionFactory

      public io.ebean.ExpressionFactory expressionFactory()
      Specified by:
      expressionFactory in interface io.ebean.Database
    • autoTune

      public io.ebean.AutoTune autoTune()
      Specified by:
      autoTune in interface io.ebean.Database
    • dataSource

      public DataSource dataSource()
      Specified by:
      dataSource in interface io.ebean.Database
    • readOnlyDataSource

      public @Nullable DataSource readOnlyDataSource()
      Specified by:
      readOnlyDataSource in interface io.ebean.Database
    • initialise

      public void initialise()
      Run any initialisation required before registering with the ClusterManager.
    • start

      public void start()
      Start any services after registering with the ClusterManager.
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface io.ebean.Database
    • shutdown

      public void shutdown(boolean shutdownDataSource, boolean deregisterDriver)
      Specified by:
      shutdown in interface io.ebean.Database
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • name

      public String name()
      Return the server name.
      Specified by:
      name in interface io.ebean.bean.BeanCollectionLoader
      Specified by:
      name in interface io.ebean.Database
    • clockNow

      public long clockNow()
      Description copied from interface: SpiEbeanServer
      Return the NOW time from the Clock.
      Specified by:
      clockNow in interface SpiEbeanServer
    • beanState

      public io.ebean.BeanState beanState(Object bean)
      Specified by:
      beanState in interface io.ebean.Database
    • compileQuery

      public <T> CQuery<T> compileQuery(SpiQuery.Type type, SpiQuery<T> query, io.ebean.Transaction transaction)
      Compile a query. Only valid for ORM queries.
      Specified by:
      compileQuery in interface SpiEbeanServer
    • cacheManager

      public io.ebean.cache.ServerCacheManager cacheManager()
      Specified by:
      cacheManager in interface io.ebean.Database
    • refreshMany

      public void refreshMany(Object parentBean, String propertyName)
      Specified by:
      refreshMany in interface io.ebean.Database
    • loadMany

      public void loadMany(LoadManyRequest loadRequest)
      Description copied from interface: SpiEbeanServer
      Lazy load a batch of Many's.
      Specified by:
      loadMany in interface SpiEbeanServer
    • loadMany

      public void loadMany(io.ebean.bean.BeanCollection<?> bc, boolean onlyIds)
      Specified by:
      loadMany in interface io.ebean.bean.BeanCollectionLoader
    • refresh

      public void refresh(Object bean)
      Specified by:
      refresh in interface io.ebean.Database
    • loadBean

      public void loadBean(LoadBeanRequest loadRequest)
      Description copied from interface: SpiEbeanServer
      Load a batch of Associated One Beans.
      Specified by:
      loadBean in interface SpiEbeanServer
    • beanLoader

      public io.ebean.bean.BeanLoader beanLoader()
      Specified by:
      beanLoader in interface io.ebean.plugin.SpiServer
    • loadBean

      public void loadBean(io.ebean.bean.EntityBeanIntercept ebi)
      Specified by:
      loadBean in interface io.ebean.plugin.SpiServer
    • loadBeanRef

      public void loadBeanRef(io.ebean.bean.EntityBeanIntercept ebi)
      Specified by:
      loadBeanRef in interface io.ebean.plugin.SpiServer
    • loadBeanL2

      public void loadBeanL2(io.ebean.bean.EntityBeanIntercept ebi)
      Specified by:
      loadBeanL2 in interface io.ebean.plugin.SpiServer
    • diff

      public Map<String, io.ebean.ValuePair> diff(@Nullable Object a, Object b)
      Specified by:
      diff in interface io.ebean.Database
    • externalModification

      public void externalModification(TransactionEventTable tableEvent)
      Process committed beans from another framework or server in another cluster.

      This notifies this instance of the framework that beans have been committed externally to it. Either by another framework or clustered server. It needs to maintain its cache and text indexes appropriately.

      Specified by:
      externalModification in interface SpiEbeanServer
    • externalModification

      public void externalModification(String tableName, boolean inserts, boolean updates, boolean deletes)
      Developer informing eBean that tables where modified outside of eBean. Invalidate the cache etc as required.
      Specified by:
      externalModification in interface io.ebean.Database
    • truncate

      public void truncate(Class<?>... types)
      Specified by:
      truncate in interface io.ebean.Database
    • truncate

      public void truncate(String... tables)
      Specified by:
      truncate in interface io.ebean.Database
    • clearQueryStatistics

      public void clearQueryStatistics()
      Clear the query execution statistics.
      Specified by:
      clearQueryStatistics in interface SpiEbeanServer
    • createEntityBean

      public <T> T createEntityBean(Class<T> type)
      Create a new EntityBean bean.

      This will generally return a subclass of the parameter 'type' which additionally implements the EntityBean interface. That is, the returned bean is typically an instance of a dynamically generated class.

      Specified by:
      createEntityBean in interface io.ebean.Database
    • reference

      public <T> T reference(Class<T> type, Object id)
      Return a Reference bean.

      If a current transaction is active then this will check the Context of that transaction to see if the bean is already loaded. If it is already loaded then it will returned that object.

      Specified by:
      reference in interface io.ebean.Database
    • register

      public void register(io.ebean.TransactionCallback transactionCallback)
      Specified by:
      register in interface io.ebean.Database
    • createTransaction

      public io.ebean.Transaction createTransaction()
      Creates a new Transaction that is NOT stored in TransactionThreadLocal. Use this when you want a thread to have a second independent transaction.
      Specified by:
      createTransaction in interface io.ebean.Database
    • createTransaction

      public io.ebean.Transaction createTransaction(io.ebean.annotation.TxIsolation isolation)
      Create a transaction additionally specify the Isolation level.

      Note that this transaction is not stored in a thread local.

      Specified by:
      createTransaction in interface io.ebean.Database
    • executeCall

      public <T> T executeCall(Callable<T> callable)
      Specified by:
      executeCall in interface io.ebean.Database
    • executeCall

      public <T> T executeCall(@Nullable io.ebean.TxScope scope, Callable<T> callable)
      Specified by:
      executeCall in interface io.ebean.Database
    • execute

      public void execute(Runnable runnable)
      Specified by:
      execute in interface io.ebean.Database
    • execute

      public void execute(@Nullable io.ebean.TxScope scope, Runnable runnable)
      Specified by:
      execute in interface io.ebean.Database
    • scopedTransactionEnter

      public void scopedTransactionEnter(io.ebean.TxScope txScope)
      Specified by:
      scopedTransactionEnter in interface io.ebean.plugin.SpiServer
    • scopedTransactionExit

      public void scopedTransactionExit(Object returnOrThrowable, int opCode)
      Specified by:
      scopedTransactionExit in interface io.ebean.plugin.SpiServer
    • currentServerTransaction

      public @Nullable SpiTransaction currentServerTransaction()
      Description copied from interface: SpiEbeanServer
      Return the current transaction or null if there is no current transaction.
      Specified by:
      currentServerTransaction in interface SpiEbeanServer
    • beginTransaction

      public io.ebean.Transaction beginTransaction()
      Specified by:
      beginTransaction in interface io.ebean.Database
    • beginTransaction

      public io.ebean.Transaction beginTransaction(io.ebean.TxScope txScope)
      Specified by:
      beginTransaction in interface io.ebean.Database
    • beginTransaction

      public io.ebean.Transaction beginTransaction(io.ebean.annotation.TxIsolation isolation)
      Specified by:
      beginTransaction in interface io.ebean.Database
    • currentTransaction

      public io.ebean.Transaction currentTransaction()
      Specified by:
      currentTransaction in interface io.ebean.Database
    • flush

      public void flush()
      Specified by:
      flush in interface io.ebean.Database
    • endTransaction

      public void endTransaction()
      Description copied from interface: SpiEbeanServer
      End the current transaction if it is active.
      Specified by:
      endTransaction in interface SpiEbeanServer
    • nextId

      public Object nextId(Class<?> beanType)
      Specified by:
      nextId in interface io.ebean.Database
    • sort

      public <T> void sort(List<T> list, String sortByClause)
      Specified by:
      sort in interface io.ebean.Database
    • validateQuery

      public <T> Set<String> validateQuery(io.ebean.Query<T> query)
      Specified by:
      validateQuery in interface io.ebean.Database
    • filter

      public <T> io.ebean.Filter<T> filter(Class<T> beanType)
      Specified by:
      filter in interface io.ebean.Database
    • update

      public <T> io.ebean.UpdateQuery<T> update(Class<T> beanType)
      Specified by:
      update in interface io.ebean.Database
    • merge

      public void merge(Object bean)
      Specified by:
      merge in interface io.ebean.Database
    • merge

      public void merge(Object bean, io.ebean.MergeOptions options)
      Specified by:
      merge in interface io.ebean.Database
    • merge

      public void merge(Object bean, io.ebean.MergeOptions options, @Nullable io.ebean.Transaction transaction)
      Specified by:
      merge in interface io.ebean.Database
    • lock

      public void lock(Object bean)
      Specified by:
      lock in interface io.ebean.Database
    • find

      public <T> io.ebean.Query<T> find(Class<T> beanType)
      Specified by:
      find in interface io.ebean.Database
    • findNative

      public <T> io.ebean.Query<T> findNative(Class<T> beanType, String nativeSql)
      Specified by:
      findNative in interface io.ebean.Database
    • createQuery

      public <T> DefaultOrmQuery<T> createQuery(Class<T> beanType)
      Description copied from interface: SpiEbeanServer
      Override in order to return SpiQuery
      Specified by:
      createQuery in interface io.ebean.Database
      Specified by:
      createQuery in interface SpiEbeanServer
    • createUpdate

      public <T> io.ebean.Update<T> createUpdate(Class<T> beanType, String ormUpdate)
      Specified by:
      createUpdate in interface io.ebean.Database
    • findDto

      public <T> io.ebean.DtoQuery<T> findDto(Class<T> dtoType, String sql)
      Specified by:
      findDto in interface io.ebean.Database
    • findDto

      public <T> io.ebean.DtoQuery<T> findDto(Class<T> dtoType, SpiQuery<?> ormQuery)
      Description copied from interface: SpiEbeanServer
      Return / wrap the ORM query as a DTO query.
      Specified by:
      findDto in interface SpiEbeanServer
    • findResultSet

      public SpiResultSet findResultSet(SpiQuery<?> ormQuery)
      Description copied from interface: SpiEbeanServer
      Execute the underlying ORM query returning as a JDBC ResultSet to map to DTO beans.
      Specified by:
      findResultSet in interface SpiEbeanServer
    • sqlQuery

      public io.ebean.SqlQuery sqlQuery(String sql)
      Specified by:
      sqlQuery in interface io.ebean.Database
    • sqlUpdate

      public io.ebean.SqlUpdate sqlUpdate(String sql)
      Specified by:
      sqlUpdate in interface io.ebean.Database
    • createCallableSql

      public io.ebean.CallableSql createCallableSql(String sql)
      Specified by:
      createCallableSql in interface io.ebean.Database
    • find

      public <T> T find(Class<T> beanType, Object uid)
      Specified by:
      find in interface io.ebean.Database
    • find

      public <T> T find(Class<T> beanType, Object id, @Nullable io.ebean.Transaction transaction)
      Find a bean using its unique id.
      Specified by:
      find in interface io.ebean.Database
    • createFormulaProperty

      public <T> STreeProperty createFormulaProperty(SpiBeanType desc, String formula, String path)
      Specified by:
      createFormulaProperty in interface SpiEbeanServer
    • persistenceContextScope

      public io.ebean.PersistenceContextScope persistenceContextScope(SpiQuery<?> query)
      Return the PersistenceContextScope to use defined at query or server level.
      Specified by:
      persistenceContextScope in interface SpiEbeanServer
    • findOneOrEmpty

      public <T> Optional<T> findOneOrEmpty(SpiQuery<T> query)
      Specified by:
      findOneOrEmpty in interface SpiEbeanServer
    • findOne

      public <T> @Nullable T findOne(SpiQuery<T> query)
      Specified by:
      findOne in interface SpiEbeanServer
    • findSet

      public <T> Set<T> findSet(SpiQuery<T> query)
      Specified by:
      findSet in interface SpiEbeanServer
    • findMap

      public <K,T> Map<K,T> findMap(SpiQuery<T> query)
      Specified by:
      findMap in interface SpiEbeanServer
    • findSingleAttributeList

      public <A,T> List<A> findSingleAttributeList(SpiQuery<T> query)
      Specified by:
      findSingleAttributeList in interface SpiEbeanServer
    • findSingleAttributeSet

      public <A,T> Set<A> findSingleAttributeSet(SpiQuery<T> query)
      Specified by:
      findSingleAttributeSet in interface SpiEbeanServer
    • findCount

      public <T> int findCount(SpiQuery<T> query)
      Specified by:
      findCount in interface SpiEbeanServer
    • findCountWithCopy

      public <T> int findCountWithCopy(SpiQuery<T> query)
      Description copied from interface: SpiEbeanServer
      Execute the findCount query but without copying the query.
      Specified by:
      findCountWithCopy in interface SpiEbeanServer
    • exists

      public boolean exists(Class<?> beanType, Object beanId, io.ebean.Transaction transaction)
      Description copied from interface: SpiEbeanServer
      Return true if a row for the bean type and id exists.
      Specified by:
      exists in interface SpiEbeanServer
    • exists

      public <T> boolean exists(SpiQuery<T> ormQuery)
      Specified by:
      exists in interface SpiEbeanServer
    • findIds

      public <A,T> List<A> findIds(SpiQuery<T> query)
      Specified by:
      findIds in interface SpiEbeanServer
    • findIdsWithCopy

      public <A,T> List<A> findIdsWithCopy(SpiQuery<T> query)
      Description copied from interface: SpiEbeanServer
      Execute the findId's query but without copying the query.

      Used so that the list of Id's can be made accessible to client code before the query has finished (if executing in a background thread).

      Specified by:
      findIdsWithCopy in interface SpiEbeanServer
    • delete

      public <T> int delete(SpiQuery<T> query)
      Specified by:
      delete in interface SpiEbeanServer
    • update

      public <T> int update(SpiQuery<T> query)
      Specified by:
      update in interface SpiEbeanServer
    • findFutureCount

      public <T> io.ebean.FutureRowCount<T> findFutureCount(SpiQuery<T> query)
      Specified by:
      findFutureCount in interface SpiEbeanServer
    • findFutureIds

      public <T> io.ebean.FutureIds<T> findFutureIds(SpiQuery<T> query)
      Specified by:
      findFutureIds in interface SpiEbeanServer
    • findFutureList

      public <T> io.ebean.FutureList<T> findFutureList(SpiQuery<T> query)
      Specified by:
      findFutureList in interface SpiEbeanServer
    • findFutureMap

      public <K,T> io.ebean.FutureMap<K,T> findFutureMap(SpiQuery<T> query)
      Specified by:
      findFutureMap in interface SpiEbeanServer
    • findPagedList

      public <T> io.ebean.PagedList<T> findPagedList(SpiQuery<T> query)
      Specified by:
      findPagedList in interface SpiEbeanServer
    • findIterate

      public <T> io.ebean.QueryIterator<T> findIterate(SpiQuery<T> query)
      Specified by:
      findIterate in interface SpiEbeanServer
    • findStream

      public <T> Stream<T> findStream(SpiQuery<T> query)
      Specified by:
      findStream in interface SpiEbeanServer
    • findEach

      public <T> void findEach(SpiQuery<T> query, Consumer<T> consumer)
      Specified by:
      findEach in interface SpiEbeanServer
    • findEach

      public <T> void findEach(SpiQuery<T> query, int batch, Consumer<List<T>> consumer)
      Specified by:
      findEach in interface SpiEbeanServer
    • findEachWhile

      public <T> void findEachWhile(SpiQuery<T> query, Predicate<T> consumer)
      Specified by:
      findEachWhile in interface SpiEbeanServer
    • findVersions

      public <T> List<io.ebean.Version<T>> findVersions(SpiQuery<T> query)
      Specified by:
      findVersions in interface SpiEbeanServer
    • findList

      public <T> List<T> findList(SpiQuery<T> query)
      Specified by:
      findList in interface SpiEbeanServer
    • findOne

      public @Nullable io.ebean.SqlRow findOne(SpiSqlQuery query)
      Specified by:
      findOne in interface SpiEbeanServer
    • findEach

      public void findEach(SpiSqlQuery query, Consumer<io.ebean.SqlRow> consumer)
      Specified by:
      findEach in interface SpiEbeanServer
    • findEachWhile

      public void findEachWhile(SpiSqlQuery query, Predicate<io.ebean.SqlRow> consumer)
      Specified by:
      findEachWhile in interface SpiEbeanServer
    • findList

      public List<io.ebean.SqlRow> findList(SpiSqlQuery query)
      Specified by:
      findList in interface SpiEbeanServer
    • findEachRow

      public void findEachRow(SpiSqlQuery query, io.ebean.RowConsumer consumer)
      Description copied from interface: SpiEbeanServer
      SqlQuery find each with consumer.
      Specified by:
      findEachRow in interface SpiEbeanServer
    • findListMapper

      public <T> List<T> findListMapper(SpiSqlQuery query, io.ebean.RowMapper<T> mapper)
      Description copied from interface: SpiEbeanServer
      SqlQuery find list with mapper.
      Specified by:
      findListMapper in interface SpiEbeanServer
    • findOneMapper

      public <T> T findOneMapper(SpiSqlQuery query, io.ebean.RowMapper<T> mapper)
      Description copied from interface: SpiEbeanServer
      SqlQuery find one with mapper.
      Specified by:
      findOneMapper in interface SpiEbeanServer
    • findSingleAttributeEach

      public <T> void findSingleAttributeEach(SpiSqlQuery query, Class<T> cls, Consumer<T> consumer)
      Description copied from interface: SpiEbeanServer
      SqlQuery find single attribute streaming the result to a consumer.
      Specified by:
      findSingleAttributeEach in interface SpiEbeanServer
    • findSingleAttributeList

      public <T> List<T> findSingleAttributeList(SpiSqlQuery query, Class<T> cls)
      Description copied from interface: SpiEbeanServer
      SqlQuery find single attribute list.
      Specified by:
      findSingleAttributeList in interface SpiEbeanServer
    • findSingleAttribute

      public <T> T findSingleAttribute(SpiSqlQuery query, Class<T> cls)
      Description copied from interface: SpiEbeanServer
      SqlQuery find single attribute.
      Specified by:
      findSingleAttribute in interface SpiEbeanServer
    • findDtoEach

      public <T> void findDtoEach(SpiDtoQuery<T> query, Consumer<T> consumer)
      Description copied from interface: SpiEbeanServer
      DTO findEach query.
      Specified by:
      findDtoEach in interface SpiEbeanServer
    • findDtoEach

      public <T> void findDtoEach(SpiDtoQuery<T> query, int batch, Consumer<List<T>> consumer)
      Description copied from interface: SpiEbeanServer
      DTO findEach batch query.
      Specified by:
      findDtoEach in interface SpiEbeanServer
    • findDtoEachWhile

      public <T> void findDtoEachWhile(SpiDtoQuery<T> query, Predicate<T> consumer)
      Description copied from interface: SpiEbeanServer
      DTO findEachWhile query.
      Specified by:
      findDtoEachWhile in interface SpiEbeanServer
    • findDtoIterate

      public <T> io.ebean.QueryIterator<T> findDtoIterate(SpiDtoQuery<T> query)
      Description copied from interface: SpiEbeanServer
      DTO findIterate query.
      Specified by:
      findDtoIterate in interface SpiEbeanServer
    • findDtoStream

      public <T> Stream<T> findDtoStream(SpiDtoQuery<T> query)
      Description copied from interface: SpiEbeanServer
      DTO findStream query.
      Specified by:
      findDtoStream in interface SpiEbeanServer
    • findDtoList

      public <T> List<T> findDtoList(SpiDtoQuery<T> query)
      Description copied from interface: SpiEbeanServer
      DTO findList query.
      Specified by:
      findDtoList in interface SpiEbeanServer
    • findDtoOne

      public <T> @Nullable T findDtoOne(SpiDtoQuery<T> query)
      Description copied from interface: SpiEbeanServer
      DTO findOne query.
      Specified by:
      findDtoOne in interface SpiEbeanServer
    • save

      public void save(Object bean)
      Persist the bean by either performing an insert or update.
      Specified by:
      save in interface io.ebean.Database
    • save

      public void save(Object bean, @Nullable io.ebean.Transaction transaction)
      Save the bean with an explicit transaction.
      Specified by:
      save in interface io.ebean.Database
    • markAsDirty

      public void markAsDirty(Object bean)
      Specified by:
      markAsDirty in interface io.ebean.Database
    • update

      public void update(Object bean)
      Specified by:
      update in interface io.ebean.Database
    • update

      public void update(Object bean, @Nullable io.ebean.Transaction transaction)
      Specified by:
      update in interface io.ebean.Database
    • updateAll

      public void updateAll(Collection<?> beans) throws jakarta.persistence.OptimisticLockException
      Specified by:
      updateAll in interface io.ebean.Database
      Throws:
      jakarta.persistence.OptimisticLockException
    • updateAll

      public void updateAll(@Nullable Collection<?> beans, @Nullable io.ebean.Transaction transaction)
      Update all beans in the collection with an explicit transaction.
      Specified by:
      updateAll in interface io.ebean.Database
    • insert

      public void insert(Object bean)
      Specified by:
      insert in interface io.ebean.Database
    • insert

      public void insert(Object bean, @Nullable io.ebean.InsertOptions insertOptions)
      Specified by:
      insert in interface io.ebean.Database
    • insert

      public void insert(Object bean, @Nullable io.ebean.Transaction transaction)
      Specified by:
      insert in interface io.ebean.Database
    • insert

      public void insert(Object bean, io.ebean.InsertOptions insertOptions, io.ebean.Transaction transaction)
      Specified by:
      insert in interface io.ebean.Database
    • insertAll

      public void insertAll(Collection<?> beans)
      Specified by:
      insertAll in interface io.ebean.Database
    • insertAll

      public void insertAll(Collection<?> beans, io.ebean.InsertOptions options)
      Specified by:
      insertAll in interface io.ebean.Database
    • insertAll

      public void insertAll(@Nullable Collection<?> beans, @Nullable io.ebean.Transaction transaction)
      Specified by:
      insertAll in interface io.ebean.Database
    • insertAll

      public void insertAll(@Nullable Collection<?> beans, io.ebean.InsertOptions options, @Nullable io.ebean.Transaction transaction)
      Specified by:
      insertAll in interface io.ebean.Database
    • saveAll

      public int saveAll(Collection<?> beans, io.ebean.Transaction transaction) throws jakarta.persistence.OptimisticLockException
      Specified by:
      saveAll in interface io.ebean.Database
      Throws:
      jakarta.persistence.OptimisticLockException
    • saveAll

      public int saveAll(Collection<?> beans) throws jakarta.persistence.OptimisticLockException
      Specified by:
      saveAll in interface io.ebean.Database
      Throws:
      jakarta.persistence.OptimisticLockException
    • saveAll

      public int saveAll(Object... beans) throws jakarta.persistence.OptimisticLockException
      Specified by:
      saveAll in interface io.ebean.Database
      Throws:
      jakarta.persistence.OptimisticLockException
    • delete

      public int delete(Class<?> beanType, Object id)
      Specified by:
      delete in interface io.ebean.Database
    • delete

      public int delete(Class<?> beanType, Object id, @Nullable io.ebean.Transaction transaction)
      Specified by:
      delete in interface io.ebean.Database
    • deletePermanent

      public int deletePermanent(Class<?> beanType, Object id)
      Specified by:
      deletePermanent in interface io.ebean.Database
    • deletePermanent

      public int deletePermanent(Class<?> beanType, Object id, @Nullable io.ebean.Transaction transaction)
      Specified by:
      deletePermanent in interface io.ebean.Database
    • deleteAll

      public int deleteAll(Class<?> beanType, Collection<?> ids)
      Specified by:
      deleteAll in interface io.ebean.Database
    • deleteAll

      public int deleteAll(Class<?> beanType, Collection<?> ids, @Nullable io.ebean.Transaction transaction)
      Specified by:
      deleteAll in interface io.ebean.Database
    • deleteAllPermanent

      public int deleteAllPermanent(Class<?> beanType, Collection<?> ids)
      Specified by:
      deleteAllPermanent in interface io.ebean.Database
    • deleteAllPermanent

      public int deleteAllPermanent(Class<?> beanType, Collection<?> ids, @Nullable io.ebean.Transaction transaction)
      Specified by:
      deleteAllPermanent in interface io.ebean.Database
    • delete

      public boolean delete(Object bean)
      Delete the bean.
      Specified by:
      delete in interface io.ebean.Database
    • delete

      public boolean delete(Object bean, @Nullable io.ebean.Transaction transaction) throws jakarta.persistence.OptimisticLockException
      Delete the bean with the explicit transaction.
      Specified by:
      delete in interface io.ebean.Database
      Throws:
      jakarta.persistence.OptimisticLockException
    • deletePermanent

      public boolean deletePermanent(Object bean) throws jakarta.persistence.OptimisticLockException
      Specified by:
      deletePermanent in interface io.ebean.Database
      Throws:
      jakarta.persistence.OptimisticLockException
    • deletePermanent

      public boolean deletePermanent(Object bean, @Nullable io.ebean.Transaction transaction) throws jakarta.persistence.OptimisticLockException
      Specified by:
      deletePermanent in interface io.ebean.Database
      Throws:
      jakarta.persistence.OptimisticLockException
    • deleteAllPermanent

      public int deleteAllPermanent(Collection<?> beans)
      Specified by:
      deleteAllPermanent in interface io.ebean.Database
    • deleteAllPermanent

      public int deleteAllPermanent(Collection<?> beans, @Nullable io.ebean.Transaction transaction)
      Specified by:
      deleteAllPermanent in interface io.ebean.Database
    • deleteAll

      public int deleteAll(Collection<?> beans)
      Delete all the beans in the collection.
      Specified by:
      deleteAll in interface io.ebean.Database
    • deleteAll

      public int deleteAll(Collection<?> beans, @Nullable io.ebean.Transaction transaction)
      Delete all the beans in the collection.
      Specified by:
      deleteAll in interface io.ebean.Database
    • execute

      public int execute(io.ebean.CallableSql callSql, @Nullable io.ebean.Transaction transaction)
      Execute the CallableSql with an explicit transaction.
      Specified by:
      execute in interface io.ebean.Database
    • execute

      public int execute(io.ebean.CallableSql callSql)
      Execute the CallableSql.
      Specified by:
      execute in interface io.ebean.Database
    • execute

      public int execute(io.ebean.SqlUpdate updSql, @Nullable io.ebean.Transaction transaction)
      Execute the updateSql with an explicit transaction.
      Specified by:
      execute in interface io.ebean.Database
    • executeNow

      public int executeNow(SpiSqlUpdate sqlUpdate)
      Description copied from interface: SpiEbeanServer
      Execute the sql update regardless of transaction batch mode.
      Specified by:
      executeNow in interface SpiEbeanServer
    • addBatch

      public void addBatch(SpiSqlUpdate sqlUpdate, @Nullable SpiTransaction transaction)
      Description copied from interface: SpiEbeanServer
      Add to JDBC batch for later execution.
      Specified by:
      addBatch in interface SpiEbeanServer
    • executeBatch

      public int[] executeBatch(SpiSqlUpdate sqlUpdate, @Nullable SpiTransaction transaction)
      Description copied from interface: SpiEbeanServer
      Execute the batched statement.
      Specified by:
      executeBatch in interface SpiEbeanServer
    • execute

      public int execute(io.ebean.SqlUpdate updSql)
      Execute the updateSql.
      Specified by:
      execute in interface io.ebean.Database
    • execute

      public int execute(io.ebean.Update<?> update, @Nullable io.ebean.Transaction transaction)
      Execute the updateSql with an explicit transaction.
      Specified by:
      execute in interface io.ebean.Database
    • execute

      public int execute(io.ebean.Update<?> update)
      Execute the orm update.
      Specified by:
      execute in interface io.ebean.Database
    • descriptors

      public List<BeanDescriptor<?>> descriptors()
      Return all the BeanDescriptors.
      Specified by:
      descriptors in interface SpiEbeanServer
    • transactionManager

      public SpiTransactionManager transactionManager()
      Return the transaction manager.
      Specified by:
      transactionManager in interface SpiEbeanServer
    • register

      public void register(io.ebean.event.BeanPersistController controller)
    • deregister

      public void deregister(io.ebean.event.BeanPersistController controller)
    • isSupportedType

      public boolean isSupportedType(Type genericType)
      Description copied from interface: SpiEbeanServer
      Return true if the type is known as an Entity or Xml type or a List Set or Map of known bean types.
      Specified by:
      isSupportedType in interface SpiEbeanServer
    • beanId

      public Object beanId(Object bean, Object id)
      Specified by:
      beanId in interface io.ebean.Database
    • beanId

      public Object beanId(Object bean)
      Specified by:
      beanId in interface io.ebean.Database
    • descriptor

      public <T> BeanDescriptor<T> descriptor(Class<T> beanClass)
      Return the BeanDescriptor for a given type of bean.
      Specified by:
      descriptor in interface SpiEbeanServer
    • descriptors

      public List<BeanDescriptor<?>> descriptors(String tableName)
      Return the BeanDescriptor's for a given table name.
      Specified by:
      descriptors in interface SpiEbeanServer
    • beanTypes

      public List<? extends io.ebean.plugin.BeanType<?>> beanTypes()
      Return all the SPI BeanTypes.
      Specified by:
      beanTypes in interface io.ebean.plugin.SpiServer
    • beanTypes

      public List<? extends io.ebean.plugin.BeanType<?>> beanTypes(String tableName)
      Return the SPI bean types mapped to the given table.
      Specified by:
      beanTypes in interface io.ebean.plugin.SpiServer
    • beanType

      public <T> io.ebean.plugin.BeanType<T> beanType(Class<T> beanType)
      Return the SPI bean types for the given bean class.
      Specified by:
      beanType in interface io.ebean.plugin.SpiServer
    • descriptorById

      public BeanDescriptor<?> descriptorById(String beanClassName)
      Return the BeanDescriptor using its class name.
      Specified by:
      descriptorById in interface SpiEbeanServer
    • remoteTransactionEvent

      public void remoteTransactionEvent(RemoteTransactionEvent event)
      Another server in the cluster sent this event so that we can inform local BeanListeners of inserts updates and deletes that occurred remotely (on another server in the cluster).
      Specified by:
      remoteTransactionEvent in interface SpiEbeanServer
    • clearServerTransaction

      public void clearServerTransaction()
      Description copied from interface: SpiEbeanServer
      Clear an implicit transaction from the scope.
      Specified by:
      clearServerTransaction in interface SpiEbeanServer
    • beginServerTransaction

      public SpiTransaction beginServerTransaction()
      Description copied from interface: SpiEbeanServer
      Begin a managed transaction (Uses scope manager / ThreadLocal).
      Specified by:
      beginServerTransaction in interface SpiEbeanServer
    • createReadOnlyTransaction

      public SpiTransaction createReadOnlyTransaction(Object tenantId, boolean useMaster)
      Description copied from interface: SpiEbeanServer
      Create a ServerTransaction for query purposes.
      Specified by:
      createReadOnlyTransaction in interface SpiEbeanServer
      Parameters:
      tenantId - For multi-tenant lazy loading provide the tenantId to use.
      useMaster - Set to true when the query should use the master data source.
    • createCallOrigin

      public io.ebean.bean.CallOrigin createCallOrigin()
      Create a CallStack object.

      This trims off the avaje ebean part of the stack trace so that the first element in the CallStack should be application code.

      Specified by:
      createCallOrigin in interface SpiEbeanServer
    • json

      public io.ebean.text.json.JsonContext json()
      Specified by:
      json in interface io.ebean.Database
    • jsonExtended

      public SpiJsonContext jsonExtended()
      Description copied from interface: SpiEbeanServer
      Return the server extended Json context.
      Specified by:
      jsonExtended in interface SpiEbeanServer
    • slowQueryCheck

      public void slowQueryCheck(long timeMicros, int rowCount, SpiQuery<?> query)
      Description copied from interface: SpiEbeanServer
      Check for slow query event.
      Specified by:
      slowQueryCheck in interface SpiEbeanServer
    • checkUniqueness

      public Set<io.ebean.plugin.Property> checkUniqueness(Object bean)
      Specified by:
      checkUniqueness in interface io.ebean.Database
    • checkUniqueness

      public Set<io.ebean.plugin.Property> checkUniqueness(Object bean, @Nullable io.ebean.Transaction transaction)
      Specified by:
      checkUniqueness in interface io.ebean.Database
    • visitMetrics

      public void visitMetrics(io.ebean.meta.MetricVisitor visitor)
      Description copied from interface: SpiEbeanServer
      Visit all the metrics (typically reporting them).
      Specified by:
      visitMetrics in interface SpiEbeanServer
    • createQueryBindCapture

      public SpiQueryBindCapture createQueryBindCapture(SpiQueryPlan plan)
      Description copied from interface: SpiEbeanServer
      Create a query bind capture for the given query plan.
      Specified by:
      createQueryBindCapture in interface SpiEbeanServer