コード例 #1
0
 public int deleteDeptPsn(SalDeptPsn sdp) {
   StringBuilder sb = new StringBuilder();
   sb.append("delete SalDeptPsn sdp where sdp.id = :id");
   Query q = getSession().createQuery(sb.toString());
   q.setParameter("id", sdp.getId());
   return q.executeUpdate();
 }
コード例 #2
0
 public int changeDeptPsn(SalDeptPsn osdp, SalDeptPsn nsdp) {
   // if (nsdp.getId().equals(osdp.getId())) getHibernateTemplate().update(nsdp);
   StringBuilder sb = new StringBuilder();
   sb.append("update SalDeptPsn sdp")
       .append(" set sdp.id.depart.id = :newDepartId")
       .append(", sdp.bank = :bank")
       .append(", sdp.bankCard = :bankCard")
       .append(", sdp.comment = :comment")
       .append(" where sdp.id.branch.id = :branchId")
       .append(" and sdp.id.depart.id = :departId")
       .append(" and sdp.id.person.id = :personId");
   Query q = getSession().createQuery(sb.toString());
   q.setParameter("newDepartId", nsdp.getDepartId());
   q.setParameter("bank", nsdp.getBank());
   q.setParameter("bankCard", nsdp.getBankCard());
   q.setParameter("comment", nsdp.getComment());
   q.setParameter("branchId", osdp.getBranchId());
   q.setParameter("departId", osdp.getDepartId());
   q.setParameter("personId", osdp.getPersonId());
   return q.executeUpdate();
 }