@Lock(LockModeType.OPTIMISTIC) @Query(value = "SELECT * FROM Command AS c " + "WHERE c.eventId IN (" + " SELECT MAX(c1.eventId) FROM Command AS c1 " + " INNER JOIN Command AS c2 on c1.globalTxId = c2.globalTxId" + " WHERE c1.status = 'NEW' " + " GROUP BY c1.globalTxId " + " HAVING MAX( CASE c2.status WHEN 'PENDING' THEN 1 ELSE 0 END ) = 0) " + "ORDER BY c.eventId ASC LIMIT 1", nativeQuery = true) List<Command> findFirstGroupByGlobalTxIdWithoutPendingOrderByIdDesc(); }
@Lock(LockModeType.OPTIMISTIC) @Query("SELECT t FROM TxTimeout AS t " + "WHERE t.status = 'NEW' " + " AND t.expiryTime < CURRENT_TIMESTAMP " + "ORDER BY t.expiryTime ASC") List<TxTimeout> findFirstTimeoutTxOrderByExpireTimeAsc(Pageable pageable);
/** * Finds a App by its name. * * @param name The App name * @return The App found */ @Lock(LockModeType.NONE) App findByName(String name);
@Lock(LockModeType.PESSIMISTIC_WRITE) List<T> findAllPessimistic(Specification<T> spec); }
@Lock(LockModeType.PESSIMISTIC_WRITE) DBUserProfile findByUserCatalogId(String userCatalogId); }
@Lock(LockModeType.PESSIMISTIC_WRITE) CocosExecutor findByBusinessId(String businessId); }
@Override @Lock(LockModeType.PESSIMISTIC_WRITE) KeyPairs save(KeyPairs entity);
@Lock(LockModeType.PESSIMISTIC_WRITE) T findOnePessimistic(ID id);
@Lock(LockModeType.PESSIMISTIC_WRITE) DBUserProfile findByBusinessId(String businessId);
@Lock(LockModeType.PESSIMISTIC_WRITE) CocosQuery getForUpdateById(Long id);
@Lock(LockModeType.PESSIMISTIC_WRITE) Optional<KeyPairs> findFirstOptionalByAvailableOrderByIdAsc(Boolean used);
/** * Finds a App by its client Id. * * @param clientId The client id * @return The App found */ @Lock(LockModeType.NONE) @Cacheable(ConstantsCache.APPS_CLIENT_ID) App findByClientId(String clientId);
@Lock(LockModeType.PESSIMISTIC_WRITE) @Query("select c from Connection c where c.needURI = ?1 and c.state != ?2") List<Connection> getConnectionsByNeedURIAndNotInStateForUpdate(URI needURI, ConnectionState connectionState);
/** * Finds a List of {@link Plan} associated with a App. * * @param appId The App Id * @return The list of Plan */ @Lock(LockModeType.NONE) @Query("select p from App a join a.plans p where a.id = :appId") List<Plan> findPlansByApp(@Param("appId") Long appId);
@Lock(LockModeType.PESSIMISTIC_WRITE) @Query("select msg from MessageEventPlaceholder msg where msg.parentURI = :parent and " + "referencedByOtherMessage = false") List<MessageEventPlaceholder> findByParentURIAndNotReferencedByOtherMessageForUpdate( @Param("parent") URI parentURI); @Query("select msg from MessageEventPlaceholder msg where msg.parentURI = :parent and " +
@Lock(LockModeType.PESSIMISTIC_WRITE) @Query("select d from DatasetHolder d where d.uri = :uri") public DatasetHolder findOneByUriForUpdate(@Param("uri") URI uri); }
@Lock(LockModeType.PESSIMISTIC_WRITE) @Query("select app from OwnerApplication app where app.ownerApplicationId = :ownerApplicationId") List<OwnerApplication> findByOwnerApplicationIdForUpdate(@Param("ownerApplicationId") String ownerApplicationId); }
@Lock(LockModeType.PESSIMISTIC_WRITE) @Query("select c from NeedEventContainer c where c.parentUri = :parentUri") public NeedEventContainer findOneByParentUriForUpdate(@Param("parentUri") URI parentUri);
@Lock(LockModeType.PESSIMISTIC_WRITE) @Query("select msg from MessageEventPlaceholder msg where msg.parentURI = :parent and msg.messageType = :messageType") List<MessageEventPlaceholder> findByParentURIAndMessageTypeForUpdate( @Param("parent") URI parentURI, @Param("messageType") WonMessageType messageType);
@Lock(LockModeType.PESSIMISTIC_WRITE) @Query("select con,c from NeedEventContainer c join MessageEventPlaceholder msg on msg.parentURI = c.parentUri join Connection con on c.parentUri = con.connectionURI where msg.messageURI = :messageUri") public void lockConnectionAndEventContainerByContainedMessageForUpdate(@Param("messageUri") URI messageUri);