query2.setParameter("employeeId", id);
System.out.println("(Transfer) size of list is: "+query2.list().size());
if (query2.list().size() == 0)
{
throw new InternalException("User ID does not exist in the database!");
}
else if (deptid == 0)
{
throw new InternalException("Please select a department!");
}
InternalAccount temp = (InternalAccount) query2.list().get(0);
if (temp.getDeptid() == 100){
throw new InternalException("Cannot transfer Corporate Level officials!");
}
else{
Query query = session.getNamedQuery("findinternaluserbyidanddeptid");
query.setParameter("employeeId", id);
query.setParameter("deptid", deptid);
System.out.println("size of list is: "+query.list().size());
if (!(query.list().size() == 0))
{
throw new InternalException("User ID already exists in this Department!");
}
else{
Query query1 = session.getNamedQuery("transferinternaluser");
/*Query query1 = session.createQuery("update InternalAccount set deptid = :deptid where employeeId = :employeeId");*/
query1.setParameter("employeeId", id);