Skip to content

Commit

Permalink
SAK-44439 Lessons delete content is not removed from persistence (sak…
Browse files Browse the repository at this point in the history
  • Loading branch information
ern authored Oct 14, 2020
1 parent b89b868 commit 90b01f3
Showing 1 changed file with 10 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -803,41 +803,25 @@ public boolean deleteItem(Object o) {
}

try {
getHibernateTemplate().delete(o);
Object p = getDaoHibernateTemplate().merge(o);
getHibernateTemplate().delete(p);
getHibernateTemplate().flush();
return true;
} catch (DataAccessException | IllegalArgumentException e) {
try {

/* If we have multiple objects of the same item, you must merge them
* before deleting. If the first delete fails, we merge and try again.
*/
getHibernateTemplate().delete(getHibernateTemplate().merge(o));

return true;
}catch(DataAccessException | IllegalArgumentException ex) {
log.warn("Hibernate could not delete: " + ex.toString());
return false;
}
log.warn("Hibernate could not delete: {}", e.toString());
return false;
}
}

public boolean quickDelete(Object o) {
try {
getHibernateTemplate().delete(o);
Object p = getHibernateTemplate().merge(o);
getHibernateTemplate().delete(p);
getHibernateTemplate().flush();
return true;
} catch (DataAccessException | IllegalArgumentException e) {
try {

/* If we have multiple objects of the same item, you must merge them
* before deleting. If the first delete fails, we merge and try again.
*/
getHibernateTemplate().delete(getHibernateTemplate().merge(o));

return true;
}catch(DataAccessException ex) {
log.warn("Hibernate could not delete: " + e.toString());
return false;
}
log.warn("Hibernate could not delete: {}", e.toString());
return false;
}
}

Expand Down

0 comments on commit 90b01f3

Please sign in to comment.