Interface CrudWriteService

    • Method Detail

      • create

        <T> T create​(T t)
      • update

        <T> T update​(T t)
      • refresh

        <T> T refresh​(T t)
        refresh an entity from the database
        Type Parameters:
        T -
        Parameters:
        t -
        Returns:
      • batchSave

        <T extends EntityInterfaceStream<T> batchSave​(Collection<T> entities,
                                                        Integer flushCount)
        save multiple entities, NOTE that normally only after commit or flush entitymanagers will reflect changes caused by saving all entities, this may cause entitylisteners to fail. You may need to perform checks on the collection before calling this method. Also note that entitylisteners will execute within the batch transaction, you may need to specify Transactional.TxType on the bean that you use in your listeners, use isolation level 0 (not recommended) or use XA when you need to access resources from your listeners. When flushCount != null flushes and clears the entitymanager every flushCount entities. NOTE that this method executes in one (possibly big) sql transaction! You can use EntityException in for example your listeners to find out in case of failure which enitity caused it.
        Parameters:
        entities -
        flushCount - when not null try to optimize (flush/clear) every so many entities
        Returns:
        the saved entities
        See Also:
        Util.getBean(Class, Annotation...)
      • batchDelete

        int batchDelete​(Collection<? extends EntityInterface> entities,
                        Integer flushCount)
        save multiple entities, NOTE that normally only after commit or flush entitymanagers will reflect changes caused by saving all entities, this may cause entitylisteners to fail. You may need to perform checks on the collection before calling this method. Also note that entitylisteners will execute within the batch transaction, you may need to specify Transactional.TxType on the bean that you use in your listeners, use isolation level 0 (not recommended) or use XA when you need to access resources from your listeners. When flushCount != null flushes and clears the entitymanager every flushCount entities. NOTE that this method executes in one (possibly big) sql transaction! You can use EntityException in for example your listeners to find out in case of failure which enitity caused it.
        Parameters:
        entities -
        flushCount - when not null try to optimize (flush/clear) every so many entities
        Returns:
        number of entities deleted
        See Also:
        Util.getBean(Class, Annotation...)
      • getEntityManager

        jakarta.persistence.EntityManager getEntityManager()