/** * Begin read-only transaction. Default to regular transaction. * * @return the database transaction */ default DataStoreTransaction beginReadTransaction() { return beginTransaction(); } }
@Override protected DataStoreTransaction beginTransaction(DataStore dataStore) { // begin updating transaction return dataStore.beginTransaction(); }
/** * Begin read-only transaction. Default to regular transaction. * * @return the database transaction */ default DataStoreTransaction beginReadTransaction() { return beginTransaction(); } }
@Test public void verifySession() throws IOException { try (DataStoreTransaction tx = dataStore.beginTransaction()) { tx.commit(null); } }
/** * Attempt to reverse changes of last commit since not all transactions successfully committed. * @param restoreList List of database managers to reverse the last commit * @param cause cause to add any suppressed exceptions */ private void reverseTransactions(ArrayList<DataStore> restoreList, Throwable cause, RequestScope requestScope) { for (DataStore dataStore : restoreList) { try (DataStoreTransaction transaction = dataStore.beginTransaction()) { List<Object> list = dirtyObjects.get(dataStore); for (Object dirtyObject : list == null ? Collections.emptyList() : list) { Object cloned = clonedObjects.get(dirtyObject); if (cloned == NEWLY_CREATED_OBJECT) { transaction.delete(dirtyObject, requestScope); } else { transaction.save(cloned, requestScope); } } transaction.commit(requestScope); } catch (RuntimeException | IOException e) { cause.addSuppressed(e); } } }
JsonNode jsonDocument) { boolean isVerbose = false; try (DataStoreTransaction tx = elide.getDataStore().beginTransaction()) { final User user = tx.accessUser(getUser.apply(securityContext)); GraphQLRequestScope requestScope = new GraphQLRequestScope(tx, user, elide.getElideSettings());
@Test public void accessParentBean() throws IOException { DataStoreTransaction tx = dataStore.beginTransaction(); Parent parent = new Parent(); parent.setChildren(new HashSet<>()); parent.setSpouses(new HashSet<>()); tx.createObject(parent, null); tx.commit(null); tx.close(); } }
JsonNode jsonDocument) { boolean isVerbose = false; try (DataStoreTransaction tx = elide.getDataStore().beginTransaction()) { final User user = tx.accessUser(getUser.apply(securityContext)); GraphQLRequestScope requestScope = new GraphQLRequestScope(tx, user, elide.getElideSettings());
@BeforeClass public static void setup() throws IOException { DataStoreTransaction tx = dataStore.beginTransaction(); Embedded embedded = new Embedded(); // id 1 embedded.setSegmentIds(ImmutableSet.of(3L, 4L, 5L)); tx.createObject(embedded, null); Left left = new Left(); Right right = new Right(); left.setOne2one(right); right.setOne2one(left); tx.createObject(left, null); tx.createObject(right, null); tx.commit(null); tx.close(); }
@BeforeClass public static void setup() throws IOException { DataStoreTransaction tx = dataStore.beginTransaction();