@Test public void testBasicOperations() { Account e = buildAccount(-1); // Get the default EbeanServer and save EbeanServer server = Ebean.getServer(null); server.save(e); Assert.assertNotNull(e.getId()); e.setEmail("banana"); server.update(e); // find by id Account e2 = server.find(Account.class, e.getId()); Assert.assertNotNull("we found it in the db", e2); Assert.assertTrue("different instance", e2 != e); Assert.assertEquals("updated description", "banana", e2.getEmail()); server.delete(e2); Account e3 = server.find(Account.class, e.getId()); Assert.assertNull("its been deleted", e3); Query<Card> query = Ebean.find(Card.class); }
@Override public void deleteHomeInvite(HomeInvite homeInvite) throws StorageException { Transaction tx = ebean.beginTransaction(); tx.setPersistCascade(false); ebean.delete(homeInvite, tx); tx.commit(); }
void removeSign(TeleportSign ts) { signs.remove(ts); database.delete(ts); if (debugmode) Bukkit.getLogger() .log( Level.INFO, "[TeleportSigns] Removed TeleportSign at {0}", ts.getLocation().toString()); }
private void deleteBrewery() { System.out.print("brewery to delete: "); String name = scanner.nextLine(); Brewery foundBrewery = server.find(Brewery.class).where().like("name", name).findUnique(); if (foundBrewery == null) { System.out.println(name + " not found"); } else { server.delete(foundBrewery); System.out.println("brewery: " + name + " has been deleted"); } }
private void deleteBeer() { System.out.print("beer to delete: "); String n = scanner.nextLine(); Beer beerToDelete = server.find(Beer.class).where().like("name", n).findUnique(); if (beerToDelete == null) { System.out.println(n + " not found"); return; } server.delete(beerToDelete); System.out.println("deleted: " + beerToDelete); }
/** {@inheritDoc} */ @Override @Transactional public void delete(Session session) { ebean.delete(session); }