Fix missed caller in last commit. Convert to use uniqueResult.
authorStefan Hühner <stefan.huehner@openbravo.com>
Tue, 08 Mar 2011 13:09:33 +0100
changeset 11088 ae2755c148fd
parent 11087 7e9a7978463b
child 11089 5ca988e24a8c
Fix missed caller in last commit. Convert to use uniqueResult.
modules/org.openbravo.client.myob/src/org/openbravo/client/myob/URLWidgetProvider.java
--- a/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/URLWidgetProvider.java	Tue Mar 08 13:08:42 2011 +0100
+++ b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/URLWidgetProvider.java	Tue Mar 08 13:09:33 2011 +0100
@@ -21,9 +21,9 @@
 import org.apache.log4j.Logger;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONObject;
+import org.hibernate.criterion.Expression;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.dal.service.OBDao;
-import org.openbravo.dal.service.OBDao.Constraint;
 
 /**
  * Responsible for creating the URL Widgets.
@@ -53,8 +53,8 @@
       final JSONObject jsonObject = super.getWidgetClassDefinition();
       final JSONObject parameters = new JSONObject();
       jsonObject.put(WidgetProvider.PARAMETERS, parameters);
-      final WidgetURL widgetURL = OBDao.getOneInstance(WidgetURL.class, new Constraint(
-          WidgetURL.PROPERTY_WIDGETCLASS, getWidgetClass()));
+      final WidgetURL widgetURL = (WidgetURL) OBDao.getFilteredCriteria(WidgetURL.class,
+          Expression.eq(WidgetURL.PROPERTY_WIDGETCLASS, getWidgetClass())).uniqueResult();
       if (widgetURL != null) {
         parameters.put(SRC, widgetURL.getURL());
       } else {
@@ -76,8 +76,8 @@
       final JSONObject jsonObject = new JSONObject();
       addDefaultWidgetProperties(jsonObject, widgetInstance);
       final JSONObject parameters = jsonObject.getJSONObject(WidgetProvider.PARAMETERS);
-      final WidgetURL widgetURL = OBDao.getOneInstance(WidgetURL.class, new Constraint(
-          WidgetURL.PROPERTY_WIDGETCLASS, getWidgetClass()));
+      final WidgetURL widgetURL = (WidgetURL) OBDao.getFilteredCriteria(WidgetURL.class,
+          Expression.eq(WidgetURL.PROPERTY_WIDGETCLASS, getWidgetClass())).uniqueResult();
       if (widgetURL != null) {
         parameters.put(SRC, widgetURL.getURL());
       } else {