Exemplo n.º 1
0
  public void addUserInfo() {

    UserInfoVO userInfoVO = new UserInfoVO();

    userInfoVO.setUserName("Taven.Li");
    userInfoVO.setUserAge(30);

    userInfoDao.saveJobLog(userInfoVO);
  }
Exemplo n.º 2
0
  @Transactional
  public void showUserInfo() {
    // 事物要被外部类调用才会生效,被自己调用不会生效

    List<UserInfoVO> list = userInfoDao.getAllUserInfo();
    for (UserInfoVO vo : list) {
      Set<OrderVO> orderVOs = vo.getOrderVOs();
      log.info("订单数:" + orderVOs.size());
      for (OrderVO orderVO : orderVOs) {
        log.info("ProductName:" + orderVO.getProductName());
      }

      Set<FriendVO> friendVOs = vo.getFriendVOs();
      log.info("朋友数:" + friendVOs.size());
      for (FriendVO friendVO : friendVOs) {
        log.info("FriendName:" + friendVO.getFriendName());
      }
    }

    log.info("当前共有数据:" + list.size());
  }