Spring update method: updates the specified entity object

update(Object entity)

Example

public static void main(String[] args){
  ApplicationContext context = new ClassPathXmlApplicationContext("cfg/XMLConfig.xml");  //加载配置文件
  Dao dao = (Dao)context.getBean("dao");  //创建Dao
  HibernateTemplate htm = dao.getHibernateTemplate();
  TbUser user = (TbUser)htm.get(TbUser.class,1);
  user.setAge(user.getAge()+1);
  htm.update(user);
}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>