Search in sources :

Example 11 with User

use of com.zsm.ssh.model.User in project Resource by lovelifeming.

the class UserDaoImplTest method deleteUserByEntity.

@Test
public void deleteUserByEntity() throws Exception {
    User user = getUser();
    user.setId(10);
    userDao.deleteUserByEntity(user);
}
Also used : User(com.zsm.ssh.model.User) Test(org.junit.Test)

Example 12 with User

use of com.zsm.ssh.model.User in project Resource by lovelifeming.

the class UserDaoImpl method deleteUserByEntity.

@Override
@Transactional(propagation = Propagation.REQUIRED)
public void deleteUserByEntity(User user) {
    Session session = sessionFactory.getCurrentSession();
    // 传入实例对象,比较id删除对应行,,没有id匹配就不删除
    session.delete(User.class.getName(), user);
}
Also used : User(com.zsm.ssh.model.User) Session(org.hibernate.Session) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

User (com.zsm.ssh.model.User)12 Test (org.junit.Test)6 Session (org.hibernate.Session)4 Transactional (org.springframework.transaction.annotation.Transactional)4 List (java.util.List)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 JSONObject (net.sf.json.JSONObject)1 Action (org.apache.struts2.convention.annotation.Action)1