Package org.springbyexample.web.orm.entity

Examples of org.springbyexample.web.orm.entity.Person


    }

    @Override
    @Transactional
    public Person saveAddress(Integer id, Address address) {
        Person person = findById(id);

        if (person.getAddresses().contains(address)) {
            person.getAddresses().remove(address);
        }

        person.getAddresses().add(address);       

        return save(person);
    }
View Full Code Here


    }

    @Override
    @Transactional
    public Person deleteAddress(Integer id, Integer addressId) {
        Person person = findById(id);
       
        Address address = new Address();
        address.setPk(addressId);       

        if (person.getAddresses().contains(address)) {
            person.getAddresses().remove(address);
        }

        return save(person);
    }
View Full Code Here

     * For every request for this controller, this will
     * create a person instance for the form.
     */
    @ModelAttribute
    public Person newRequest(@RequestParam(required=false) Integer id) {
        return (id != null ? repository.findOne(id) : new Person());
    }
View Full Code Here

    public Person form(Person person, Model model) {
        if (person.getCreated() == null) {
            person.setCreated(new Date());
        }

        Person result = repository.saveAndFlush(person);
       
        model.addAttribute("statusMessageKey", "person.form.msg.success");
       
        return result;
    }
View Full Code Here

     * For every request for this controller, this will
     * create a person instance for the form.
     */
    @ModelAttribute
    public Person newRequest(@RequestParam(required=false) Integer id) {
        return (id != null ? service.findById(id) : new Person());
    }
View Full Code Here

    public Person form(Person person, Model model) {
        if (person.getCreated() == null) {
            person.setCreated(new Date());
        }

        Person result = service.save(person);
       
        model.addAttribute("statusMessageKey", "person.form.msg.success");
       
        return result;
    }
View Full Code Here

TOP

Related Classes of org.springbyexample.web.orm.entity.Person

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.