@Override public int execute() { return server.execute(this); }
public void execute() { server.execute(this, null); }
/** * Execute a TxRunnable in a Transaction with an explicit scope. * <p> * The scope can control the transaction type, isolation and rollback * semantics. * </p> * <pre>{@code * * // set specific transactional scope settings * TxScope scope = TxScope.requiresNew().setIsolation(TxIsolation.SERIALIZABLE); * * Ebean.execute(scope, new TxRunnable() { * public void run() { * User u1 = Ebean.find(User.class, 1); * ... * } * }); * * }</pre> */ public static void execute(TxScope scope, Runnable r) { serverMgr.getDefaultServer().execute(scope, r); }
/** * For making calls to stored procedures. * <p> * Example: * </p> * <pre>{@code * * String sql = "{call sp_order_modify(?,?,?)}"; * * CallableSql cs = Ebean.createCallableSql(sql); * cs.setParameter(1, 27); * cs.setParameter(2, "SHIPPED"); * cs.registerOut(3, Types.INTEGER); * * Ebean.execute(cs); * * // read the out parameter * Integer returnValue = (Integer) cs.getObject(3); * * }</pre> * * @see CallableSql * @see Ebean#execute(SqlUpdate) */ public static int execute(CallableSql callableSql) { return serverMgr.getDefaultServer().execute(callableSql); }
/** * Execute a Runnable in a Transaction with the default scope. * <p> * The default scope runs with REQUIRED and by default will rollback on any * exception (checked or runtime). * </p> * <pre>{@code * * Ebean.execute(() -> { * * User u1 = Ebean.find(User.class, 1); * User u2 = Ebean.find(User.class, 2); * * u1.setName("u1 mod"); * u2.setName("u2 mod"); * * Ebean.save(u1); * Ebean.save(u2); * * }); * * }</pre> */ public static void execute(Runnable r) { serverMgr.getDefaultServer().execute(r); }
return serverMgr.getDefaultServer().execute(sqlUpdate);
@Override public int execute() { return server.execute(this); }
public void execute() { server.execute(this, null); }
/** * Execute a TxRunnable in a Transaction with an explicit scope. * <p> * The scope can control the transaction type, isolation and rollback * semantics. * </p> * <pre>{@code * * // set specific transactional scope settings * TxScope scope = TxScope.requiresNew().setIsolation(TxIsolation.SERIALIZABLE); * * Ebean.execute(scope, new TxRunnable() { * public void run() { * User u1 = Ebean.find(User.class, 1); * ... * } * }); * * }</pre> */ public static void execute(TxScope scope, Runnable r) { serverMgr.getDefaultServer().execute(scope, r); }
/** * For making calls to stored procedures. * <p> * Example: * </p> * <pre>{@code * * String sql = "{call sp_order_modify(?,?,?)}"; * * CallableSql cs = Ebean.createCallableSql(sql); * cs.setParameter(1, 27); * cs.setParameter(2, "SHIPPED"); * cs.registerOut(3, Types.INTEGER); * * Ebean.execute(cs); * * // read the out parameter * Integer returnValue = (Integer) cs.getObject(3); * * }</pre> * * @see CallableSql * @see Ebean#execute(SqlUpdate) */ public static int execute(CallableSql callableSql) { return serverMgr.getDefaultServer().execute(callableSql); }
/** * Execute a Runnable in a Transaction with the default scope. * <p> * The default scope runs with REQUIRED and by default will rollback on any * exception (checked or runtime). * </p> * <pre>{@code * * Ebean.execute(() -> { * * User u1 = Ebean.find(User.class, 1); * User u2 = Ebean.find(User.class, 2); * * u1.setName("u1 mod"); * u2.setName("u2 mod"); * * Ebean.save(u1); * Ebean.save(u2); * * }); * * }</pre> */ public static void execute(Runnable r) { serverMgr.getDefaultServer().execute(r); }
return serverMgr.getDefaultServer().execute(sqlUpdate);
@Override public void drop() { String sql = "DELETE from " + tableName; SqlUpdate sqlUpdate = ebean().createSqlUpdate(sql); ebean().execute(sqlUpdate); }
@Override public void drop() { String sql = "DELETE from " + tableName; SqlUpdate sqlUpdate = ebean_(false).createSqlUpdate(sql); ebean_(false).execute(sqlUpdate); }
private void insertCountries() { server.execute(() -> { new Country("NZ", "New Zealand").save(); new Country("AU", "Australia").save(); }); }