Examples of PersonRepository


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

Examples of core.PersonRepository

public class JdbcDemo {

  public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("config.xml", JdbcDemo.class);
    PersonRepository personRepository = context.getBean(PersonRepository.class);
    System.out.println("There are currently " + personRepository.count() + " people in the DB:");
    List<Person> people = personRepository.getAll();
    for (Person person : people) {
      System.out.println(person);
    }
  }
View Full Code Here

Examples of core.PersonRepository

public class TxDemo {

  public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("config.xml", TxDemo.class);
    PersonRepository repository = context.getBean(PersonRepository.class);
    PersonService service = context.getBean(PersonService.class);
    System.out.println("before: " + repository.count());
    try {
      service.addPeople();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
    System.out.println("after: " + repository.count());
  }
View Full Code Here

Examples of core.PersonRepository

    Set<String> keys = redisTemplate.keys(RedisHashPersonRepository.REDIS_KEY_PATTERN);
    if (keys != null && keys.size() > 0) {
      redisTemplate.delete(keys);
    }
   
    PersonRepository personRepository = context.getBean(RedisHashPersonRepository.class);
   
    // add some people
    Person mark = new Person("Mark");
    mark.setCity("Cambridge");
    mark.setState("MA");
    personRepository.add(mark);
    Person thomas = new Person("Thomas");
    thomas.setState("NH");
    personRepository.add(thomas);
   
    System.out.println("There are currently " + personRepository.count() + " people in the DB:");
    List<Person> people = personRepository.getAll();
    for (Person person : people) {
      System.out.println(person);
    }

  }
View Full Code Here

Examples of core.PersonRepository

    // clear out old test data first
    RedisConnectionFactory connectionFactory = context.getBean(RedisConnectionFactory.class);
    new RedisTemplate<String, Person>(connectionFactory)
        .delete(Collections.singletonList(RedisSetPersonRepository.REDIS_KEY));
   
    PersonRepository personRepository = context.getBean(RedisSetPersonRepository.class);
   
    // add some people
    Person mark = new Person("Mark");
    mark.setCity("Cambridge");
    mark.setState("MA");
    personRepository.add(mark);
    Person thomas = new Person("Thomas");
    thomas.setState("NH");
    personRepository.add(thomas);
   
    System.out.println("There are currently " + personRepository.count() + " people in the DB:");
    List<Person> people = personRepository.getAll();
    for (Person person : people) {
      System.out.println(person);
    }

  }
View Full Code Here

Examples of core.PersonRepository

            Person bubba = new Person("Bubba");
            return null;
          }
            });

    PersonRepository personRepository = context.getBean(PersonRepository.class);
    System.out.println("There are currently " + personRepository.count() + " people in the DB:");
    List<Person> people = personRepository.getAll();
    for (Person person : people) {
      System.out.println(person.toString() + " has " + person.friendsToString());
    }

    context.close();
View Full Code Here

Examples of core.PersonRepository

   
    // clear out old test data first
    Mongo mongo = context.getBean(Mongo.class);
    mongo.getDB("test").getCollection("people").drop();
   
    PersonRepository personRepository = context.getBean(PersonRepository.class);
   
    // add some people
    Person mark = new Person("Mark");
    Map<String, Object> marksPersonalInfo = new HashMap<String, Object>();
    marksPersonalInfo.put("Project Lead", "Spring Integration");
    marksPersonalInfo.put("Location", "Cambridge, MA");
    mark.setPersonalInfo(marksPersonalInfo);
    personRepository.add(mark);
    Person thomas = new Person("Thomas");
    Map<String, Object> thomasPersonalInfo = new HashMap<String, Object>();
    thomasPersonalInfo.put("Hobby", "photography");
    thomasPersonalInfo.put("Sport", "soccer");
    thomasPersonalInfo.put("Location", "Stratham, NH");
    thomas.setPersonalInfo(thomasPersonalInfo);
    personRepository.add(thomas);
   
    System.out.println("There are currently " + personRepository.count() + " people in the DB:");
    List<Person> people = personRepository.getAll();
    for (Person person : people) {
      System.out.println(person);
      if (person.getPersonalInfo().containsKey("Interests")) {
        System.out.println(person.getPersonalInfo().get("Interests").getClass().getName());
        System.out.println(person.getPersonalInfo().get("Interests"));
View Full Code Here

Examples of model.repos.PersonRepository

    PersonRepository pRepo;

    @Before
    public void setUp() throws Exception {
        pRepo = new PersonRepository();
    }
View Full Code Here

Examples of model.repos.PersonRepository

    private MarriageRegistry registry;
    private PersonRepository repository;

    public MarriageService() {
        registry = new MarriageRegistry();
        repository = new PersonRepository();
    }
View Full Code Here

Examples of org.springframework.data.gemfire.repository.sample.PersonRepository

    assertEquals(DataPolicy.EMPTY, simple.getAttributes().getDataPolicy());
  }

  @Test
  public void testRepositoryCreated() {
    PersonRepository repo = ctx.getBean(PersonRepository.class);
    Person dave = new Person(1L, "Dave", "Mathhews");
    repo.save(dave);
    Person saved = repo.findOne(1L);
    assertEquals("Dave", saved.getFirstname());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.