@Transactional
 void ensureContact() {
   if (contacts.all().count() == 0) {
     Contact c = new Contact();
     c.setFirstName("John");
     c.setLastName("Smith");
     c.setEmail("*****@*****.**");
     contacts.save(c);
   }
 }
Ejemplo n.º 2
0
  @Transactional
  public void prepareTest3() {
    final MetaSelect select = new MetaSelect();
    final MetaSelectItem item = new MetaSelectItem();

    final MetaSelectRepository selects = Beans.get(MetaSelectRepository.class);
    final ContactRepository contacts = Beans.get(ContactRepository.class);

    item.setValue("pizza");
    item.setTitle("Pizza");
    select.addItem(item);
    select.setName("food.selection");

    selects.save(select);

    Contact c = new Contact();
    c.setFirstName("John");
    c.setLastName("Smith");
    c.setEmail("*****@*****.**");
    c.setFood("pizza");

    contacts.save(c);
  }