Package com.example.mvc.repository

Examples of com.example.mvc.repository.PersonRepository


    @Override
    public void contextInitialized(ServletContextEvent sce) {
        LOGGER.debug("initializing..");
        WebApplicationContext ctx = WebApplicationContextUtils
                .getWebApplicationContext(sce.getServletContext());
        PersonRepository personRepository = ctx.getBean(PersonRepository.class);
        personRepository.deleteAll();
        List<Person> persons = new ArrayList<Person>();

        int itemCount = 100;
        int chunkSize = 25;
        for (int i = 1; i <= itemCount; i++) {
            Person p = new Person();
            p.setAge((i % 100) + 1);
            p.setName("name" + i);
            persons.add(p);
            if ((i % chunkSize) == 0) {
                personRepository.save(persons);
                persons.clear();
            }
        }
        personRepository.save(persons);
    }
View Full Code Here

TOP

Related Classes of com.example.mvc.repository.PersonRepository

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.