@Transaction(TransactionIsolationLevel.SERIALIZABLE) public Optional<List<KeyRecord>> get(String number, long deviceId) { final KeyRecord record = retrieveFirst(number, deviceId); if (record != null && !record.isLastResort()) { removeKey(record.getId()); } else if (record == null) { return Optional.empty(); } List<KeyRecord> results = new LinkedList<>(); results.add(record); return Optional.of(results); }
PassThroughTransactionHandler(Method m, Transaction tx) { this.isolation = tx.value(); }
PassThroughTransactionHandler(Method m, Transaction tx) { this.isolation = tx.value(); }
@Transaction(TransactionIsolationLevel.SERIALIZABLE) public Optional<List<KeyRecord>> get(String number) { List<KeyRecord> preKeys = retrieveFirst(number); if (preKeys != null) { for (KeyRecord preKey : preKeys) { if (!preKey.isLastResort()) { removeKey(preKey.getId()); } } } if (preKeys != null) return Optional.of(preKeys); else return Optional.empty(); }
@Transaction(TransactionIsolationLevel.SERIALIZABLE) public void store(String number, long deviceId, List<PreKey> keys) { List<KeyRecord> records = new LinkedList<>(); for (PreKey key : keys) { records.add(new KeyRecord(0, number, deviceId, key.getKeyId(), key.getPublicKey(), false)); } removeKeys(number, deviceId); append(records); }
@Transaction(TransactionIsolationLevel.SERIALIZABLE) public boolean create(Account account) { int rows = removeAccount(account.getNumber()); insertStep(account); return rows == 0; }
@Transaction void delete(Long id); }
@Transaction Long insert(T instance);
@Transaction Long update(T instance);
@SqlUpdate("delete from PERSON_ADDRESS where personId = :pa.personId and addressId = :pa.addressId") @Transaction void delete(@BindBean("pa") PersonAddressAssoc personAddressAssoc); }
@SqlUpdate("delete from PERSON_ADDRESS where personId = :pa.personId and addressId = :pa.addressId") @Transaction void delete(@BindBean("pa") PersonAddressAssoc personAddressAssoc); }
@SqlUpdate("delete from PERSON where personId = :id") @Transaction void delete(@Bind("id") Long id); }
@SqlUpdate("update PERSON set name = :p.name, email = :p.emailVal, phone = :p.phone where personId = :p.id") @Transaction void update(@BindBean("p") Person person);
@Transaction public void insert(CountDownLatch inserted, int id, String name) throws InterruptedException { reallyInsert(id, name); inserted.countDown(); }
@Transaction public Something failed(int id, String name) throws IOException { insert(id, name); throw new IOException("woof"); } }
@Transaction public void insertInNestedTransaction(final int id, final String name) { insertInSingleTransaction(id, name); }
@Transaction public Something insertAndFetchWithNestedTransaction(int id, String name) { return insertAndFetch(id, name); }
@Transaction public Something insertAndFetchWithNestedTransaction(int id, String name) { return insertAndFetch(id, name); }
@Transaction public void insertInSingleTransaction(final int id, final String name) { insert(id, name); }
@Transaction public void insert(CountDownLatch inserted, int id, String name) throws InterruptedException { reallyInsert(id, name); inserted.countDown(); }