Hibernate Session.delete() an object if exists

前端 未结 7 1741
谎友^
谎友^ 2020-12-31 03:41

In JavaDoc of Session class the description of delete method is:

Remove a persistent instance from the datastore. The argument may be

相关标签:
7条回答
  • 2020-12-31 04:21

    Hibernate native query sample as follows.

    import org.hibernate.query.nativeQuery;  
    
    String sql = "Delete from Student where classId= :id"; 
    NativeQuery query = session.createNativeQuery(sql.toString()); 
    query.executeUpdate();
    
    0 讨论(0)
提交回复
热议问题