/** * Deletes this entity. */ public void delete() { Ebean.delete(this); }
/** * Return a named EbeanServer that is typically different to the default server. * <p> * If you are using multiple databases then each database has a name and maps to a single * EbeanServer. You can use this method to get an EbeanServer for another database. * * @param server The name of the EbeanServer. If this is null then the default EbeanServer is returned. */ public static EbeanServer db(String server) { return Ebean.getServer(server); }
public F.Promise<Result> call(final Context ctx) throws Throwable { return Ebean.execute(new TxCallable<F.Promise<Result>>() { public F.Promise<Result> call() { try { return delegate.call(ctx); } catch(RuntimeException e) { throw e; } catch(Throwable t) { throw new RuntimeException(t); } } }); }
/** * Loads properties from database. * * @return true if load successfully. */ private boolean loadPropertiesFromDatabase() { List<ru.iris.common.database.model.Config> dbcfg = Ebean.find(ru.iris.common.database.model.Config.class).findList(); for (ru.iris.common.database.model.Config line : dbcfg) { propertyMap.put(line.getParam(), line.getValue()); } return true; }
/** * Less Than or Equal to - property less than or equal to the given value. */ public static Expression le(String propertyName, Object value) { return Ebean.getExpressionFactory().le(propertyName, value); }
/** * Saves (inserts) this entity. */ public void save() { Ebean.save(this); }
/** * Create using the ServerConfig object to configure the server. */ public static EbeanServer create(ServerConfig config) { if (config.getName() == null) { throw new PersistenceException("The name is null (it is required)"); } EbeanServer server = serverFactory.createServer(config); if (config.isDefaultServer()) { GlobalProperties.setSkipPrimaryServer(true); } if (config.isRegister()) { Ebean.register(server, config.isDefaultServer()); } return server; }
/** * Updates this entity. */ public void update() { Ebean.update(this); }
private void update(String state) { ModuleStatus status = Ebean.find(ModuleStatus.class).where().eq("internalName", internalName).findUnique(); if (status != null) { status.setLastseen(new Timestamp(new Date().getTime())); status.setStatus(state); status.save(); } else { LOGGER.error("Error update module status! Module not found in DB!"); } }
/** * Create the query by Example expression specifying more options. */ public static ExampleExpression exampleLike(Object example, boolean caseInsensitive, LikeType likeType) { return Ebean.getExpressionFactory().exampleLike(example, caseInsensitive, likeType); }
/** * Save all the beans from a Collection. */ public static int save(Collection<?> c) throws OptimisticLockException { return save(c.iterator()); }
/** * Create using the ServerConfig object to configure the server. */ public static synchronized EbeanServer create(ServerConfig config) { if (config.getName() == null) { throw new PersistenceException("The name is null (it is required)"); } EbeanServer server = createInternal(config); if (config.isDefaultServer()) { PrimaryServer.setSkip(true); } if (config.isRegister()) { Ebean.register(server, config.isDefaultServer()); } return server; }
/** * Updates this entity, by specifying the entity ID. */ public void update(Object id) { _setId(id); Ebean.update(this); }
public boolean checkExist() { ModuleStatus status = Ebean.find(ModuleStatus.class).where().eq("internalName", internalName).findUnique(); return status != null; }
/** * Return typically a different EbeanServer to the default. * <p> * This is equivalent to {@link Ebean#getServer(String)} * * @param server The name of the EbeanServer. If this is null then the default EbeanServer is * returned. */ public EbeanServer db(String server) { return Ebean.getServer(server); }
/** * Case insensitive Contains - property like %value%. Typically uses a lower() * function to make the expression case insensitive. */ public static Expression icontains(String propertyName, String value) { return Ebean.getExpressionFactory().icontains(propertyName, value); }
/** * Delete all the beans from a Collection. */ public static int delete(Collection<?> c) throws OptimisticLockException { return delete(c.iterator()); }
public int execute() { if (server != null) { return server.execute(this); } else { // Hopefully this doesn't catch anyone out... return Ebean.execute(this); } }