Package com.apress.prospring.ch10.domain

Examples of com.apress.prospring.ch10.domain.Test


    }
    System.out.println("Took " + (System.currentTimeMillis() - startMillis) + " ms");   
  }
 
  private void customer() {
    CustomerDao customerDao = (CustomerDao)context.getBean("customerDao");
   
    Customer janm = customerDao.getById(1);
    Customer robh = customerDao.getById(2);
   
    System.out.println(janm);
    System.out.println(robh);
  }
View Full Code Here


    System.out.println(janm);
    System.out.println(robh);
  }
 
  private void order() {
    OrderDao orderDao = (OrderDao)context.getBean("orderDao");
    Order order = orderDao.getById(1);     
    System.out.println(order);
  }
View Full Code Here

 
  private ApplicationContext context;
 
  private void test() {
    System.out.println("Getting testDao");
    TestDao testDao = (TestDao)context.getBean("testDao");
   
    Date today = Calendar.getInstance().getTime();

    System.out.println("Inserting new Test record");
    Test test = new Test();
    test.setName("new one");
    test.setRunDate(today);
    testDao.save(test);
   
    System.out.println("Test inserted " + test);
   
    List tests = testDao.getAll();
    for (Iterator i = tests.iterator(); i.hasNext();) {
      test = (Test)i.next();
      System.out.println(test);
    }
   
    long startMillis = System.currentTimeMillis();
    for (int i = 0; i < 25000; i++) {
      testDao.getByNameAndRunDate("foo", today);
    }
    System.out.println("Took " + (System.currentTimeMillis() - startMillis) + " ms");
   
    startMillis = System.currentTimeMillis();
    for (int i = 0; i < 5000; i++) {
      testDao.updateName(1, "foobar");
    }
    System.out.println("Took " + (System.currentTimeMillis() - startMillis) + " ms");   
  }
View Full Code Here

  }
 
  private void customer() {
    CustomerDao customerDao = (CustomerDao)context.getBean("customerDao");
   
    Customer janm = customerDao.getById(1);
    Customer robh = customerDao.getById(2);
   
    System.out.println(janm);
    System.out.println(robh);
  }
View Full Code Here

    System.out.println(robh);
  }
 
  private void order() {
    OrderDao orderDao = (OrderDao)context.getBean("orderDao");
    Order order = orderDao.getById(1);     
    System.out.println(order);
  }
View Full Code Here

    TestDao testDao = (TestDao)context.getBean("testDao");
   
    Date today = Calendar.getInstance().getTime();

    System.out.println("Inserting new Test record");
    Test test = new Test();
    test.setName("new one");
    test.setRunDate(today);
    testDao.save(test);
   
    System.out.println("Test inserted " + test);
   
    List tests = testDao.getAll();
View Full Code Here

    params.put("runDate", runDate);
    return getSqlMapClientTemplate().queryForList("getTestsByNameAndRunDateMap", params);
  }

  public List getByNameAndRunDateDO(String name, Date runDate) {
    Test test = new Test();
    test.setName(name);
    test.setRunDate(runDate);
    return getSqlMapClientTemplate().queryForList("getTestsByNameAndRunDateDO", test);
  }
View Full Code Here

    try {
      connection = getConnection();
      PreparedStatement statement = connection.prepareStatement("select * from Test");
      ResultSet resultSet = statement.executeQuery();
      while (resultSet.next()) {
        Test test = new Test();
        test.setName(resultSet.getString("Name"));
        test.setTestId(resultSet.getInt("TestId"));
        result.add(test);
      }
    } catch (SQLException ex) {
      ex.printStackTrace();
    } finally {
View Full Code Here

        private int testId = -1;
       
        public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
          List result = new ArrayList();
          int lastTestId = -1;
          Test test = null;
          ResultSet rs = ps.executeQuery();
          while (rs.next()) {
            testId = rs.getInt("TestId");
            if (testId != lastTestId) {
              test = new Test();
              test.setTestId(testId);
              test.setName(rs.getString("Name"));
              test.setDetails(new ArrayList());
            }
            TestDetail td = new TestDetail();
            td.setData(rs.getString("Data"));
            td.setTest(rs.getInt("Test"));
            td.setTestDetailId(rs.getInt("TestDetailId"));
            test.getDetails().add(td);
          }
          return result;
        }
     
      });
View Full Code Here

    public AbstractSelect(DataSource dataSource, String sql) {
      super(dataSource, sql);
    }

    protected Object mapRow(ResultSet rs, int rowNum) throws SQLException {
      Test test = new Test();

      test.setName(rs.getString("Name"));
      test.setTestId(rs.getInt("TestId"));

      return test;
    }
View Full Code Here

TOP

Related Classes of com.apress.prospring.ch10.domain.Test

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.