@Override
  public HomeInvite findHomeInviteById(int id) {
    String q = "find homeInvite where id = :id";

    Query<HomeInvite> query = ebean.createQuery(HomeInvite.class, q);
    query.setParameter("id", id);

    return query.findUnique();
  }
 @Test
 public void testFind() throws Exception {
   InetAddressRecord record = getMockInetAddressRecord();
   when(query.findUnique()).thenReturn(record);
   Assert.assertEquals("Record should be the same!", record, manager.find("127.0.0.1"));
   verify(query).setParameter("address", "127.0.0.1");
   verify(query, times(1)).findUnique();
 }
 public static Official findByNumber(String number, ProcessingType processingType) {
   Official official;
   Query<Official> query = null;
   if (processingType.equals(ProcessingType.batch)) query = ebeanServer.find(Official.class);
   else if (processingType.equals(ProcessingType.online)) query = Ebean.find(Official.class);
   query.where().eq("number", number);
   official = query.findUnique();
   return official;
 }
 public static Official findByName(
     String lastName, String firstName, ProcessingType processingType) {
   Official official;
   Query<Official> query = null;
   if (processingType.equals(ProcessingType.batch)) query = ebeanServer.find(Official.class);
   else if (processingType.equals(ProcessingType.online)) query = Ebean.find(Official.class);
   query.where().eq("lastName", lastName);
   query.where().eq("firstName", firstName);
   official = query.findUnique();
   return official;
 }
  @Override
  public HomeInvite findInviteByHomeAndInvitee(Home home, String invitee) {
    String q;
    if (configCore.useEbeanSearchLower())
      q = "find homeInvite where home = :home and lower(invitedPlayer) = lower(:invitee)";
    else q = "find homeInvite where home = :home and invitedPlayer = :invitee";

    Query<HomeInvite> query = ebean.createQuery(HomeInvite.class, q);
    query.setParameter("home", home.getId());
    query.setParameter("invitee", invitee);

    return query.findUnique();
  }
 public static Official findByKey(String key, String value) {
   Query<Official> query = Ebean.find(Official.class);
   query.where().eq(key, value);
   Official official = query.findUnique();
   return official;
 }
 @Test
 public void testExists() throws Exception {
   InetAddressRecord record = getMockInetAddressRecord();
   when(query.findUnique()).thenReturn(record);
   Assert.assertTrue("Record should exist!", manager.exists("127.0.0.1"));
 }