Package org.activejpa.examples.petclinic.model

Examples of org.activejpa.examples.petclinic.model.Visit


  @Test
  @Transactional
  public void insertVisit() {
      Pet pet7 = this.clinicService.findPetById(7);
      int found = pet7.getVisits().size();
      Visit visit = new Visit();
      pet7.addVisit(visit);
      visit.setDescription("test");
      // both storeVisit and storePet are necessary to cover all ORM tools
      this.clinicService.saveVisit(visit);
      this.clinicService.savePet(pet7);
      pet7 = this.clinicService.findPetById(7);
      assertEquals(found + 1, pet7.getVisits().size());
      assertNotNull(visit.getId(), "Visit Id should have been generated");
  }
View Full Code Here


    }

    @RequestMapping(value = "/owners/*/pets/{petId}/visits/new", method = RequestMethod.GET)
    public String initNewVisitForm(@PathVariable("petId") int petId, Map<String, Object> model) {
        Pet pet = this.clinicService.findPetById(petId);
        Visit visit = new Visit();
        pet.addVisit(visit);
        model.put("visit", visit);
        return "pets/createOrUpdateVisitForm";
    }
View Full Code Here

TOP

Related Classes of org.activejpa.examples.petclinic.model.Visit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.