Flushing Entity using JmixDataRepository

Hi,
I am using the following interface for an Entity:

public interface ApiObjRepository extends JmixDataRepository<ApiObj, Long> {

    Optional<ApiObj> findByAction(String storeName);

    Boolean existsByDomain(String storeName);

    @Query("SELECT k FROM ApiObj k where k.transactionId=:transactionId and k.messageId=:messageId")
    List<ApiObj> findByTransactionIdAndMessageId(@Param("transactionId") String transactionId, @Param("messageId") String messageId);

    @Query("SELECT k FROM ApiObj k where k.transactionId=:transactionId")
    List<ApiBuyerObj> findByTransactionId(String transactionId);

I can able to save the entity like:

mApiAuditRepository.save(myApiObj);

But how do i save and flush the entity as i do with JpaRepository

mApiAuditRepository.saveAndFlush(myconfirmAuditObj);

Is there any solution available for saveAndFlush in Jmix?

Thanks.

Hi @vimalkumar010

JmixDataRepository works on top of DataManager and operates only with detached entities, even within a transaction. So its save() method always flushes the entity immediately and you may be sure the entity is changed in the database. You don’t need a separate saveAndFlush() method.

Regards,
Konstantin