Spring update method: updates the specified entity object
•
Java
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
二维码