com.avaje.ebean.Ebean.find()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中com.avaje.ebean.Ebean.find()方法的一些代码示例,展示了Ebean.find()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ebean.find()方法的具体详情如下:
包路径:com.avaje.ebean.Ebean
类名称:Ebean
方法名:find

Ebean.find介绍

[英]Create a query for a type of entity bean.

This is actually the same as #createQuery(Class). The reason it exists is that people used to JPA will probably be looking for a createQuery method (the same as entityManager).
[中]创建一个实体bean类型的查询。
这实际上与#createQuery(类)相同。它存在的原因是,习惯JPA的人可能会寻找createQuery方法(与entityManager相同)。

代码示例

代码示例来源:origin: MrNeuronix/IRISv2

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!");
  }
}

代码示例来源:origin: MrNeuronix/IRISv2

/**
 * 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;
}

代码示例来源:origin: MrNeuronix/IRISv2

public static Device getDeviceByNode(short node)
{
  return Ebean.find(Device.class).where().eq("node", node).findUnique();
}

代码示例来源:origin: MrNeuronix/IRISv2

private Device loadByChannel(int channel) {
  for (Device device : Ebean.find(Device.class).where().eq("source", "noolite").findList()) {
    if (device.getInternalName().equals("noolite/channel/" + channel)) {
      return device;
    }
  }
  return null;
}

代码示例来源:origin: MrNeuronix/IRISv2

public static boolean isLocked(String title)
{
  return Ebean.find(ScriptLock.class).where().eq("title", title).findUnique() != null;
}

代码示例来源:origin: MrNeuronix/IRISv2

public static Device getDeviceByUUID(String uuid)
{
  return Ebean.find(Device.class).where().eq("uuid", uuid).findUnique();
}

代码示例来源:origin: MrNeuronix/IRISv2

public boolean checkExist() {
  ModuleStatus status = Ebean.find(ModuleStatus.class).where().eq("internalName", internalName).findUnique();
  return status != null;
}

代码示例来源:origin: MrNeuronix/IRISv2

@Override
  public void onNotification(JsonEnvelope envelope) throws RuntimeException, SchedulerException, InterruptedException, ClassNotFoundException {
    if (envelope.getObject() instanceof TasksStartAdvertisement) {
      LOGGER.info("Start/restart scheduler service!");
      readAndScheduleTasks();
    } else if (envelope.getObject() instanceof TasksStopAdvertisement) {
      LOGGER.info("Stop scheduler service");
      // reload events
      scheduler.shutdown();
      events = null;
      cronevents = null;
    } else if (envelope.getObject() instanceof TaskSourcesChangesAdvertisement) {
      LOGGER.info("Reload sources list");
      // reload sources
      sources = null;
      sources = Ebean.find(DataSource.class).where().eq("enabled", true).findList();
      // take pause to save/remove new entity
      Thread.sleep(500);
      readSources();
      LOGGER.info("Loaded " + sources.size() + " sources.");
    } else if (envelope.getObject() instanceof TaskChangesAdvertisement) {
      LOGGER.info("Reload tasks list");
      readAndScheduleTasks();
    }
  }
});

代码示例来源:origin: MrNeuronix/IRISv2

private void reloadService() throws RuntimeException {
  LOGGER.info("Reload event service");
  // unsubscribe current events
  for (Event event : events) {
    jsonMessaging.unsubscribe(event.getSubject());
    LOGGER.debug("Unsubscribe from subject: " + event.getSubject());
  }
  events = Ebean.find(Event.class).findList();
  // subscribe to events from db
  for (Event event : events) {
    jsonMessaging.subscribe(event.getSubject());
    LOGGER.debug("Subscribe from subject: " + event.getSubject());
  }
  // take pause to save/remove new entity
  try {
    Thread.sleep(500);
  } catch (InterruptedException e) {
    e.printStackTrace();
  }
  // load all scripts, compile and put into map
  compiledScriptMap = loadAndCompile(events);
  LOGGER.info("Reload event service done");
}

代码示例来源:origin: MrNeuronix/IRISv2

public static void release(String title)
{
  Ebean.delete(Ebean.find(ScriptLock.class).where().eq("title", title).findUnique());
}

代码示例来源:origin: MrNeuronix/IRISv2

public List<SensorData> getLogs() {
  return Ebean.find(SensorData.class).where().eq("uuid", this.uuid).order().desc("logdate").findList();
}

代码示例来源:origin: MrNeuronix/IRISv2

public static void set(String name, int value) {
    Device device = Ebean.find(Device.class).where().eq("friendlyname", name).findUnique();

    if (device == null) {
      LOGGER.error("Device not found: " + name);
      return;
    }
    if (value == 255)
      messaging.broadcast("event.devices.setvalue", new GenericAdvertisement("DeviceOn", device.getUuid()));
    else
      messaging.broadcast("event.devices.setvalue", new GenericAdvertisement("DeviceOff", device.getUuid()));
  }
}

代码示例来源:origin: MrNeuronix/IRISv2

cal.set(Calendar.MINUTE, 10);
Task saved = Ebean.find(Task.class).where().eq("title", "День рождения " + user.getFirstName() + " " + user.getLastName()).findUnique();

代码示例来源:origin: MrNeuronix/IRISv2

events = Ebean.find(Event.class).findList();

代码示例来源:origin: MrNeuronix/IRISv2

cronevents = null;
events = Ebean.find(Task.class)
    .where()
    .eq("enabled", true)
    .findList();
cronevents = Ebean.find(Task.class)
    .where()
    .eq("enabled", true)

代码示例来源:origin: MrNeuronix/IRISv2

private void readSources() throws RuntimeException
{
  sources = Ebean.find(DataSource.class).where().eq("enabled", true).findList();
  for (DataSource source : sources)
  {
    switch (source.getType()) {
      // google calendar
      case "gcal":
        GoogleCalendarSource.getInstance().populateCalendar(source.getObj());
        break;
      // VK.com
      case "vk":
        VKSource.getInstance().populateBirthDayCalendar(source.getObj());
        break;
      default:
        LOGGER.info("Unknown data source: " + source.getType() + "!");
        break;
    }
  }
}

代码示例来源:origin: MrNeuronix/IRISv2

device = Ebean.find(Device.class).where().eq("uuid", uuid).findUnique();

代码示例来源:origin: MrNeuronix/IRISv2

final List<Speaks> speaksList = Ebean.find(Speaks.class)
    .where()
    .and(Expr.ne("cache", 0),

代码示例来源:origin: MrNeuronix/IRISv2

for (Device ZWaveDevice : Ebean.find(Device.class).where().eq("source", "zwave").findList()) {

代码示例来源:origin: MrNeuronix/IRISv2

if ((ZWaveDevice = Ebean.find(Device.class).where().eq("internalname", "zwave/" + type + "/" + notification.getNodeId()).findUnique()) == null) {

相关文章