Package core

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


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

    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

    // 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

            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

   
    // 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

TOP

Related Classes of core.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.