Trunk 3289a #254

Closed
wants to merge 8 commits into
from

Conversation

Projects
None yet
3 participants
Contributor

andreapat commented Mar 22, 2013

Clean up code.
Javadoc.

@mseaton mseaton commented on an outdated diff Mar 22, 2013

...a/org/openmrs/api/db/hibernate/HibernateOrderDAO.java
@@ -202,4 +208,21 @@ public Integer getHighestOrderId() {
return (List<DrugOrder>) searchDrugOrderCriteria.list();
}
+ /*
+ * Delete Obs that references (deleted) Order
+ */
+ public void deleteObsThatReference(Order order) {
+ int orderId;
+
+ if (order != null) {
+ orderId = order.getOrderId();
+
+ Criteria crit = sessionFactory.getCurrentSession().createCriteria(Obs.class);
+ crit.add(Restrictions.eq("order", order));
+
+ sessionFactory.getCurrentSession().createQuery("delete Obs where order = :orderId").setInteger("orderId",
@mseaton

mseaton Mar 22, 2013

Owner

This should be the only line in this method, within the not-null check. I don't understand what you are doing with the orderId or the criteria - are they needed or used at all? Also, I would have thought that the query should be "delete Obs where order = :order"), and then :order is associated with the Order object, and let hibernate do it's thing.

wluyima referenced this pull request Jun 10, 2013

Closed

Trunk 3289a #253

wluyima closed this Jun 11, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment