Exemplo n.º 1
1
  @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();
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
  @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();
  }
Exemplo n.º 6
0
 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"));
 }