Package com.ustc.SSHDemo.user.to

Examples of com.ustc.SSHDemo.user.to.User


  @Override
  public User getUserById(Integer id) throws Exception {
//    List l = (List)this.getHibernateTemplate().find("from User u where u.id=?", id);
//    User u = (User) l.get(0);
//    return u;
    User u=(User)this.getHibernateTemplate().get(User.class, id);
    return u;
  }
View Full Code Here


  @Override
  public User getUserByName(String name) throws Exception {
//    List l = (List)this.getHibernateTemplate().find("from User u where u.name=?",name);
//    User u = (User) l.get(0);
//    return u;
    User u=(User)this.getHibernateTemplate().get(User.class, name);
    return u;
  }
View Full Code Here

    @Test 
//    @Transactional  //使用该注释会使用事务,而且在测试完成之后会回滚事务,也就是说在该方法中做出的一切操作都不会对数据库中的数据产生任何影响 
//    @Rollback(false) //这里设置为false,就让事务不回滚 
    public void testGetByName(){ 
      try {
      User u = userService.getUserById(222);
      System.out.println("**********************$"+u.getId());
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
   
    } 
View Full Code Here

TOP

Related Classes of com.ustc.SSHDemo.user.to.User

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.