public void stop() throws Exception { if (ebean != null) { ebean.get().shutdown(false, false); ebean = null; } }
public EbeanManaged(final Config config, final ServerConfig conf) { ebean = Suppliers.memoize(() -> { EbeanServer ebean = EbeanServerFactory.create(conf); // move .sql file to tmp directory... didn't find any other way of dealing with this if (conf.isDdlGenerate()) { String tmpdir = config.getString("application.tmpdir"); move(conf.getName() + "-drop-all.sql", tmpdir); move(conf.getName() + "-create-all.sql", tmpdir); } return ebean; }); }
/** * Creates a query using the ORM query language. */ public Query<T> query(String ormQuery) { return db().createQuery(type, ormQuery); }
/** * Return the current transaction. */ public Transaction currentTransaction() { return db().currentTransaction(); }
/** * Delete a bean permanently without soft delete. * <p> * This is used when the bean contains a <code>@SoftDelete</code> property and we * want to perform a hard/permanent delete. * </p> * * @see EbeanServer#deletePermanent(Object) */ public boolean deletePermanent() { return db().deletePermanent(this); }
/** * Delete a bean permanently without soft delete. * <p> * This is used when the bean contains a <code>@SoftDelete</code> property and we * want to perform a hard/permanent delete. * </p> * * @see EbeanServer#deletePermanent(Object) */ public boolean deletePermanent(T bean) { return db().deletePermanent(bean); }
/** * Creates a native sql query. */ public Query<T> nativeSql(String nativeSql) { return db().findNative(type, nativeSql); }
/** * Between - property between the two given values. */ public static Expression between(String propertyName, Object value1, Object value2) { return Ebean.getExpressionFactory().between(propertyName, value1, value2); }
/** * Create the query by Example expression which is case sensitive and using * LikeType.RAW (you need to add you own wildcards % and _). */ public static ExampleExpression exampleLike(Object example) { return Ebean.getExpressionFactory().exampleLike(example); }
/** * Contains - property like %value%. */ public static Expression contains(String propertyName, String value) { return Ebean.getExpressionFactory().contains(propertyName, value); }
/** * Add raw expression with a single parameter. * <p> * The raw expression should contain a single ? at the location of the * parameter. * </p> */ public static Expression raw(String raw, Object value) { return Ebean.getExpressionFactory().raw(raw, value); }
/** * In Range - property >= value1 and property < value2. * <p> * Unlike Between inRange is "half open" and usually more useful for use with dates or timestamps. * </p> */ public static Expression inRange(String propertyName, Object value1, Object value2) { return Ebean.getExpressionFactory().inRange(propertyName, value1, value2); }
/** * Like - property like value where the value contains the SQL wild card * characters % (percentage) and _ (underscore). */ public static Expression like(String propertyName, String value) { return Ebean.getExpressionFactory().like(propertyName, value); }
/** * All Equal - Map containing property names and their values. * <p> * Expression where all the property names in the map are equal to the * corresponding value. * </p> * * @param propertyMap a map keyed by property names. */ public static Expression allEq(Map<String, Object> propertyMap) { return Ebean.getExpressionFactory().allEq(propertyMap); }
/** * Add raw expression with an array of parameters. * <p> * The raw expression should contain the same number of ? as there are * parameters. * </p> */ public static Expression raw(String raw, Object[] values) { return Ebean.getExpressionFactory().raw(raw, values); }