You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Hans Bakker <ma...@antwebsystems.com> on 2013/05/09 11:42:10 UTC

delegator.find has a problem?

Currently there is a problem in the findshipping screen at: 
https://localhost:8443/facility/control/FindShipment, the list is empty 
although there are shipments.

When i replace the delegator.find with a delegator.findList it works again.
The code gets smaller however i can imagine the delegator.find is used 
in other places?

could it be caused by the recent refactoring?

the diff to replace find with findList:
Index: 
applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
===================================================================
--- 
applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy 
(revision 1480573)
+++ 
applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy 
(working copy)
@@ -132,25 +132,15 @@
          lowIndex = viewIndex * viewSize + 1;
          highIndex = (viewIndex + 1) * viewSize;
          findOpts.setMaxRows(highIndex);
-
+        findOpts.setOffset(lowIndex);
+
          if (!orderReturnValue) {
-            // using list iterator
-            orli = delegator.find("Shipment", mainCond, null, null, 
orderBy, findOpts);
-
-            shipmentListSize = orli.getResultsSizeAfterPartialList();
+            shipmentList = delegator.findList("Shipment", mainCond, 
null, orderBy, findOpts, false);
+            shipmentListSize = shipmentList.size();
              if (highIndex > shipmentListSize) {
                  highIndex = shipmentListSize;
              }
-
-            // get the partial list for this page
-            if (shipmentListSize > 0) {
-                shipmentList = orli.getPartialList(lowIndex, viewSize);
-            } else {
-                shipmentList = [] as ArrayList;
-            }
-
-            // close the list iterator
-            orli.close();
+
          }

          if (orderReturnValue) {
@@ -202,7 +192,7 @@
          // only commit the transaction if we started one... this will 
throw an exception if it fails
          TransactionUtil.commit(beganTransaction);
      }
-
+
      context.shipmentList = shipmentList;
      context.listSize = shipmentListSize;
      context.highIndex = highIndex;

Re: delegator.find has a problem?

Posted by Hans Bakker <ma...@antwebsystems.com>.
Thank you Adrian for your help and Jacopo for noticing this.

Regards,
Hans

On 05/10/2013 03:44 PM, Adrian Crum wrote:
> Hans and Jacopo,
>
> Hans found a legitimate problem, and I will look into it this weekend. 
> This patch is a workaround, not a proper fix. Once I have the problem 
> solved, I will revert these changes.
>
> -Adrian
>
> On 5/10/2013 9:12 AM, Jacopo Cappellato wrote:
>> I just did a cursory review but aren't we missing, with this new 
>> version, the total number of records?
>>
>> Jacopo
>>
>> On May 10, 2013, at 9:48 AM, Hans Bakker 
>> <ma...@antwebsystems.com> wrote:
>>
>>> that is why i logged it as:
>>>
>>> simplify and fix error: list always empty
>>>
>>> Regards,
>>> Hans
>>>
>>>
>>>
>>> On 05/10/2013 02:21 PM, Adrian Crum wrote:
>>>> The point I was trying to make is this: Since Delegator.findList 
>>>> calls Delegator.find, this patch is unnecessary.
>>>>
>>>> The only thing you really changed is this:
>>>>
>>>> +        findOpts.setOffset(lowIndex);
>>>>
>>>> the rest of the patch is pointless.
>>>>
>>>> -Adrian
>>>>
>>>> On 5/10/2013 7:16 AM, Hans Bakker wrote:
>>>>> Thank you for your comment, Adrian
>>>>>
>>>>> dif Committed revision 1480891.
>>>>>
>>>>> Regards,
>>>>> Hans
>>>>>
>>>>> On 05/09/2013 06:24 PM, Adrian Crum wrote:
>>>>>> Delegator.findList calls Delegator.find, so I think the problem 
>>>>>> lies somewhere else.
>>>>>>
>>>>>> If you look carefully at your patch, you might spot where it is.
>>>>>>
>>>>>> -Adrian
>>>>>>
>>>>>> On 5/9/2013 10:42 AM, Hans Bakker wrote:
>>>>>>> Currently there is a problem in the findshipping screen at: 
>>>>>>> https://localhost:8443/facility/control/FindShipment, the list 
>>>>>>> is empty although there are shipments.
>>>>>>>
>>>>>>> When i replace the delegator.find with a delegator.findList it 
>>>>>>> works again.
>>>>>>> The code gets smaller however i can imagine the delegator.find 
>>>>>>> is used in other places?
>>>>>>>
>>>>>>> could it be caused by the recent refactoring?
>>>>>>>
>>>>>>> the diff to replace find with findList:
>>>>>>> Index: 
>>>>>>> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
>>>>>>> ===================================================================
>>>>>>> --- 
>>>>>>> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy 
>>>>>>> (revision 1480573)
>>>>>>> +++ 
>>>>>>> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy 
>>>>>>> (working copy)
>>>>>>> @@ -132,25 +132,15 @@
>>>>>>>          lowIndex = viewIndex * viewSize + 1;
>>>>>>>          highIndex = (viewIndex + 1) * viewSize;
>>>>>>>          findOpts.setMaxRows(highIndex);
>>>>>>> -
>>>>>>> +        findOpts.setOffset(lowIndex);
>>>>>>> +
>>>>>>>          if (!orderReturnValue) {
>>>>>>> -            // using list iterator
>>>>>>> -            orli = delegator.find("Shipment", mainCond, null, 
>>>>>>> null, orderBy, findOpts);
>>>>>>> -
>>>>>>> -            shipmentListSize = 
>>>>>>> orli.getResultsSizeAfterPartialList();
>>>>>>> +            shipmentList = delegator.findList("Shipment", 
>>>>>>> mainCond, null, orderBy, findOpts, false);
>>>>>>> +            shipmentListSize = shipmentList.size();
>>>>>>>              if (highIndex > shipmentListSize) {
>>>>>>>                  highIndex = shipmentListSize;
>>>>>>>              }
>>>>>>> -
>>>>>>> -            // get the partial list for this page
>>>>>>> -            if (shipmentListSize > 0) {
>>>>>>> -                shipmentList = orli.getPartialList(lowIndex, 
>>>>>>> viewSize);
>>>>>>> -            } else {
>>>>>>> -                shipmentList = [] as ArrayList;
>>>>>>> -            }
>>>>>>> -
>>>>>>> -            // close the list iterator
>>>>>>> -            orli.close();
>>>>>>> +
>>>>>>>          }
>>>>>>>
>>>>>>>          if (orderReturnValue) {
>>>>>>> @@ -202,7 +192,7 @@
>>>>>>>          // only commit the transaction if we started one... 
>>>>>>> this will throw an exception if it fails
>>>>>>>          TransactionUtil.commit(beganTransaction);
>>>>>>>      }
>>>>>>> -
>>>>>>> +
>>>>>>>      context.shipmentList = shipmentList;
>>>>>>>      context.listSize = shipmentListSize;
>>>>>>>      context.highIndex = highIndex;
>


Re: delegator.find has a problem?

Posted by Adrian Crum <ad...@sandglass-software.com>.
Hans and Jacopo,

Hans found a legitimate problem, and I will look into it this weekend. 
This patch is a workaround, not a proper fix. Once I have the problem 
solved, I will revert these changes.

-Adrian

On 5/10/2013 9:12 AM, Jacopo Cappellato wrote:
> I just did a cursory review but aren't we missing, with this new version, the total number of records?
>
> Jacopo
>
> On May 10, 2013, at 9:48 AM, Hans Bakker <ma...@antwebsystems.com> wrote:
>
>> that is why i logged it as:
>>
>> simplify and fix error: list always empty
>>
>> Regards,
>> Hans
>>
>>
>>
>> On 05/10/2013 02:21 PM, Adrian Crum wrote:
>>> The point I was trying to make is this: Since Delegator.findList calls Delegator.find, this patch is unnecessary.
>>>
>>> The only thing you really changed is this:
>>>
>>> +        findOpts.setOffset(lowIndex);
>>>
>>> the rest of the patch is pointless.
>>>
>>> -Adrian
>>>
>>> On 5/10/2013 7:16 AM, Hans Bakker wrote:
>>>> Thank you for your comment, Adrian
>>>>
>>>> dif Committed revision 1480891.
>>>>
>>>> Regards,
>>>> Hans
>>>>
>>>> On 05/09/2013 06:24 PM, Adrian Crum wrote:
>>>>> Delegator.findList calls Delegator.find, so I think the problem lies somewhere else.
>>>>>
>>>>> If you look carefully at your patch, you might spot where it is.
>>>>>
>>>>> -Adrian
>>>>>
>>>>> On 5/9/2013 10:42 AM, Hans Bakker wrote:
>>>>>> Currently there is a problem in the findshipping screen at: https://localhost:8443/facility/control/FindShipment, the list is empty although there are shipments.
>>>>>>
>>>>>> When i replace the delegator.find with a delegator.findList it works again.
>>>>>> The code gets smaller however i can imagine the delegator.find is used in other places?
>>>>>>
>>>>>> could it be caused by the recent refactoring?
>>>>>>
>>>>>> the diff to replace find with findList:
>>>>>> Index: applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
>>>>>> ===================================================================
>>>>>> --- applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy (revision 1480573)
>>>>>> +++ applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy (working copy)
>>>>>> @@ -132,25 +132,15 @@
>>>>>>          lowIndex = viewIndex * viewSize + 1;
>>>>>>          highIndex = (viewIndex + 1) * viewSize;
>>>>>>          findOpts.setMaxRows(highIndex);
>>>>>> -
>>>>>> +        findOpts.setOffset(lowIndex);
>>>>>> +
>>>>>>          if (!orderReturnValue) {
>>>>>> -            // using list iterator
>>>>>> -            orli = delegator.find("Shipment", mainCond, null, null, orderBy, findOpts);
>>>>>> -
>>>>>> -            shipmentListSize = orli.getResultsSizeAfterPartialList();
>>>>>> +            shipmentList = delegator.findList("Shipment", mainCond, null, orderBy, findOpts, false);
>>>>>> +            shipmentListSize = shipmentList.size();
>>>>>>              if (highIndex > shipmentListSize) {
>>>>>>                  highIndex = shipmentListSize;
>>>>>>              }
>>>>>> -
>>>>>> -            // get the partial list for this page
>>>>>> -            if (shipmentListSize > 0) {
>>>>>> -                shipmentList = orli.getPartialList(lowIndex, viewSize);
>>>>>> -            } else {
>>>>>> -                shipmentList = [] as ArrayList;
>>>>>> -            }
>>>>>> -
>>>>>> -            // close the list iterator
>>>>>> -            orli.close();
>>>>>> +
>>>>>>          }
>>>>>>
>>>>>>          if (orderReturnValue) {
>>>>>> @@ -202,7 +192,7 @@
>>>>>>          // only commit the transaction if we started one... this will throw an exception if it fails
>>>>>>          TransactionUtil.commit(beganTransaction);
>>>>>>      }
>>>>>> -
>>>>>> +
>>>>>>      context.shipmentList = shipmentList;
>>>>>>      context.listSize = shipmentListSize;
>>>>>>      context.highIndex = highIndex;


Re: delegator.find has a problem?

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
I just did a cursory review but aren't we missing, with this new version, the total number of records?

Jacopo

On May 10, 2013, at 9:48 AM, Hans Bakker <ma...@antwebsystems.com> wrote:

> that is why i logged it as:
> 
> simplify and fix error: list always empty
> 
> Regards,
> Hans
> 
> 
> 
> On 05/10/2013 02:21 PM, Adrian Crum wrote:
>> The point I was trying to make is this: Since Delegator.findList calls Delegator.find, this patch is unnecessary.
>> 
>> The only thing you really changed is this:
>> 
>> +        findOpts.setOffset(lowIndex);
>> 
>> the rest of the patch is pointless.
>> 
>> -Adrian
>> 
>> On 5/10/2013 7:16 AM, Hans Bakker wrote:
>>> Thank you for your comment, Adrian
>>> 
>>> dif Committed revision 1480891.
>>> 
>>> Regards,
>>> Hans
>>> 
>>> On 05/09/2013 06:24 PM, Adrian Crum wrote:
>>>> Delegator.findList calls Delegator.find, so I think the problem lies somewhere else.
>>>> 
>>>> If you look carefully at your patch, you might spot where it is.
>>>> 
>>>> -Adrian
>>>> 
>>>> On 5/9/2013 10:42 AM, Hans Bakker wrote:
>>>>> Currently there is a problem in the findshipping screen at: https://localhost:8443/facility/control/FindShipment, the list is empty although there are shipments.
>>>>> 
>>>>> When i replace the delegator.find with a delegator.findList it works again.
>>>>> The code gets smaller however i can imagine the delegator.find is used in other places?
>>>>> 
>>>>> could it be caused by the recent refactoring?
>>>>> 
>>>>> the diff to replace find with findList:
>>>>> Index: applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
>>>>> ===================================================================
>>>>> --- applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy (revision 1480573)
>>>>> +++ applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy (working copy)
>>>>> @@ -132,25 +132,15 @@
>>>>>         lowIndex = viewIndex * viewSize + 1;
>>>>>         highIndex = (viewIndex + 1) * viewSize;
>>>>>         findOpts.setMaxRows(highIndex);
>>>>> -
>>>>> +        findOpts.setOffset(lowIndex);
>>>>> +
>>>>>         if (!orderReturnValue) {
>>>>> -            // using list iterator
>>>>> -            orli = delegator.find("Shipment", mainCond, null, null, orderBy, findOpts);
>>>>> -
>>>>> -            shipmentListSize = orli.getResultsSizeAfterPartialList();
>>>>> +            shipmentList = delegator.findList("Shipment", mainCond, null, orderBy, findOpts, false);
>>>>> +            shipmentListSize = shipmentList.size();
>>>>>             if (highIndex > shipmentListSize) {
>>>>>                 highIndex = shipmentListSize;
>>>>>             }
>>>>> -
>>>>> -            // get the partial list for this page
>>>>> -            if (shipmentListSize > 0) {
>>>>> -                shipmentList = orli.getPartialList(lowIndex, viewSize);
>>>>> -            } else {
>>>>> -                shipmentList = [] as ArrayList;
>>>>> -            }
>>>>> -
>>>>> -            // close the list iterator
>>>>> -            orli.close();
>>>>> +
>>>>>         }
>>>>> 
>>>>>         if (orderReturnValue) {
>>>>> @@ -202,7 +192,7 @@
>>>>>         // only commit the transaction if we started one... this will throw an exception if it fails
>>>>>         TransactionUtil.commit(beganTransaction);
>>>>>     }
>>>>> -
>>>>> +
>>>>>     context.shipmentList = shipmentList;
>>>>>     context.listSize = shipmentListSize;
>>>>>     context.highIndex = highIndex;
>>>> 
>>> 
>> 
> 


Re: delegator.find has a problem?

Posted by Hans Bakker <ma...@antwebsystems.com>.
that is why i logged it as:

simplify and fix error: list always empty

Regards,
Hans



On 05/10/2013 02:21 PM, Adrian Crum wrote:
> The point I was trying to make is this: Since Delegator.findList calls 
> Delegator.find, this patch is unnecessary.
>
> The only thing you really changed is this:
>
> +        findOpts.setOffset(lowIndex);
>
> the rest of the patch is pointless.
>
> -Adrian
>
> On 5/10/2013 7:16 AM, Hans Bakker wrote:
>> Thank you for your comment, Adrian
>>
>> dif Committed revision 1480891.
>>
>> Regards,
>> Hans
>>
>> On 05/09/2013 06:24 PM, Adrian Crum wrote:
>>> Delegator.findList calls Delegator.find, so I think the problem lies 
>>> somewhere else.
>>>
>>> If you look carefully at your patch, you might spot where it is.
>>>
>>> -Adrian
>>>
>>> On 5/9/2013 10:42 AM, Hans Bakker wrote:
>>>> Currently there is a problem in the findshipping screen at: 
>>>> https://localhost:8443/facility/control/FindShipment, the list is 
>>>> empty although there are shipments.
>>>>
>>>> When i replace the delegator.find with a delegator.findList it 
>>>> works again.
>>>> The code gets smaller however i can imagine the delegator.find is 
>>>> used in other places?
>>>>
>>>> could it be caused by the recent refactoring?
>>>>
>>>> the diff to replace find with findList:
>>>> Index: 
>>>> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
>>>> ===================================================================
>>>> --- 
>>>> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy 
>>>> (revision 1480573)
>>>> +++ 
>>>> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy 
>>>> (working copy)
>>>> @@ -132,25 +132,15 @@
>>>>          lowIndex = viewIndex * viewSize + 1;
>>>>          highIndex = (viewIndex + 1) * viewSize;
>>>>          findOpts.setMaxRows(highIndex);
>>>> -
>>>> +        findOpts.setOffset(lowIndex);
>>>> +
>>>>          if (!orderReturnValue) {
>>>> -            // using list iterator
>>>> -            orli = delegator.find("Shipment", mainCond, null, 
>>>> null, orderBy, findOpts);
>>>> -
>>>> -            shipmentListSize = orli.getResultsSizeAfterPartialList();
>>>> +            shipmentList = delegator.findList("Shipment", 
>>>> mainCond, null, orderBy, findOpts, false);
>>>> +            shipmentListSize = shipmentList.size();
>>>>              if (highIndex > shipmentListSize) {
>>>>                  highIndex = shipmentListSize;
>>>>              }
>>>> -
>>>> -            // get the partial list for this page
>>>> -            if (shipmentListSize > 0) {
>>>> -                shipmentList = orli.getPartialList(lowIndex, 
>>>> viewSize);
>>>> -            } else {
>>>> -                shipmentList = [] as ArrayList;
>>>> -            }
>>>> -
>>>> -            // close the list iterator
>>>> -            orli.close();
>>>> +
>>>>          }
>>>>
>>>>          if (orderReturnValue) {
>>>> @@ -202,7 +192,7 @@
>>>>          // only commit the transaction if we started one... this 
>>>> will throw an exception if it fails
>>>>          TransactionUtil.commit(beganTransaction);
>>>>      }
>>>> -
>>>> +
>>>>      context.shipmentList = shipmentList;
>>>>      context.listSize = shipmentListSize;
>>>>      context.highIndex = highIndex;
>>>
>>
>


Re: delegator.find has a problem?

Posted by Adrian Crum <ad...@sandglass-software.com>.
The point I was trying to make is this: Since Delegator.findList calls 
Delegator.find, this patch is unnecessary.

The only thing you really changed is this:

+        findOpts.setOffset(lowIndex);

the rest of the patch is pointless.

-Adrian

On 5/10/2013 7:16 AM, Hans Bakker wrote:
> Thank you for your comment, Adrian
>
> dif Committed revision 1480891.
>
> Regards,
> Hans
>
> On 05/09/2013 06:24 PM, Adrian Crum wrote:
>> Delegator.findList calls Delegator.find, so I think the problem lies 
>> somewhere else.
>>
>> If you look carefully at your patch, you might spot where it is.
>>
>> -Adrian
>>
>> On 5/9/2013 10:42 AM, Hans Bakker wrote:
>>> Currently there is a problem in the findshipping screen at: 
>>> https://localhost:8443/facility/control/FindShipment, the list is 
>>> empty although there are shipments.
>>>
>>> When i replace the delegator.find with a delegator.findList it works 
>>> again.
>>> The code gets smaller however i can imagine the delegator.find is 
>>> used in other places?
>>>
>>> could it be caused by the recent refactoring?
>>>
>>> the diff to replace find with findList:
>>> Index: 
>>> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
>>> ===================================================================
>>> --- 
>>> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy 
>>> (revision 1480573)
>>> +++ 
>>> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy 
>>> (working copy)
>>> @@ -132,25 +132,15 @@
>>>          lowIndex = viewIndex * viewSize + 1;
>>>          highIndex = (viewIndex + 1) * viewSize;
>>>          findOpts.setMaxRows(highIndex);
>>> -
>>> +        findOpts.setOffset(lowIndex);
>>> +
>>>          if (!orderReturnValue) {
>>> -            // using list iterator
>>> -            orli = delegator.find("Shipment", mainCond, null, null, 
>>> orderBy, findOpts);
>>> -
>>> -            shipmentListSize = orli.getResultsSizeAfterPartialList();
>>> +            shipmentList = delegator.findList("Shipment", mainCond, 
>>> null, orderBy, findOpts, false);
>>> +            shipmentListSize = shipmentList.size();
>>>              if (highIndex > shipmentListSize) {
>>>                  highIndex = shipmentListSize;
>>>              }
>>> -
>>> -            // get the partial list for this page
>>> -            if (shipmentListSize > 0) {
>>> -                shipmentList = orli.getPartialList(lowIndex, 
>>> viewSize);
>>> -            } else {
>>> -                shipmentList = [] as ArrayList;
>>> -            }
>>> -
>>> -            // close the list iterator
>>> -            orli.close();
>>> +
>>>          }
>>>
>>>          if (orderReturnValue) {
>>> @@ -202,7 +192,7 @@
>>>          // only commit the transaction if we started one... this 
>>> will throw an exception if it fails
>>>          TransactionUtil.commit(beganTransaction);
>>>      }
>>> -
>>> +
>>>      context.shipmentList = shipmentList;
>>>      context.listSize = shipmentListSize;
>>>      context.highIndex = highIndex;
>>
>


Re: delegator.find has a problem?

Posted by Hans Bakker <ma...@antwebsystems.com>.
Thank you for your comment, Adrian

dif Committed revision 1480891.

Regards,
Hans

On 05/09/2013 06:24 PM, Adrian Crum wrote:
> Delegator.findList calls Delegator.find, so I think the problem lies 
> somewhere else.
>
> If you look carefully at your patch, you might spot where it is.
>
> -Adrian
>
> On 5/9/2013 10:42 AM, Hans Bakker wrote:
>> Currently there is a problem in the findshipping screen at: 
>> https://localhost:8443/facility/control/FindShipment, the list is 
>> empty although there are shipments.
>>
>> When i replace the delegator.find with a delegator.findList it works 
>> again.
>> The code gets smaller however i can imagine the delegator.find is 
>> used in other places?
>>
>> could it be caused by the recent refactoring?
>>
>> the diff to replace find with findList:
>> Index: 
>> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
>> ===================================================================
>> --- 
>> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy 
>> (revision 1480573)
>> +++ 
>> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy 
>> (working copy)
>> @@ -132,25 +132,15 @@
>>          lowIndex = viewIndex * viewSize + 1;
>>          highIndex = (viewIndex + 1) * viewSize;
>>          findOpts.setMaxRows(highIndex);
>> -
>> +        findOpts.setOffset(lowIndex);
>> +
>>          if (!orderReturnValue) {
>> -            // using list iterator
>> -            orli = delegator.find("Shipment", mainCond, null, null, 
>> orderBy, findOpts);
>> -
>> -            shipmentListSize = orli.getResultsSizeAfterPartialList();
>> +            shipmentList = delegator.findList("Shipment", mainCond, 
>> null, orderBy, findOpts, false);
>> +            shipmentListSize = shipmentList.size();
>>              if (highIndex > shipmentListSize) {
>>                  highIndex = shipmentListSize;
>>              }
>> -
>> -            // get the partial list for this page
>> -            if (shipmentListSize > 0) {
>> -                shipmentList = orli.getPartialList(lowIndex, viewSize);
>> -            } else {
>> -                shipmentList = [] as ArrayList;
>> -            }
>> -
>> -            // close the list iterator
>> -            orli.close();
>> +
>>          }
>>
>>          if (orderReturnValue) {
>> @@ -202,7 +192,7 @@
>>          // only commit the transaction if we started one... this 
>> will throw an exception if it fails
>>          TransactionUtil.commit(beganTransaction);
>>      }
>> -
>> +
>>      context.shipmentList = shipmentList;
>>      context.listSize = shipmentListSize;
>>      context.highIndex = highIndex;
>


Re: delegator.find has a problem?

Posted by Adrian Crum <ad...@sandglass-software.com>.
Delegator.findList calls Delegator.find, so I think the problem lies 
somewhere else.

If you look carefully at your patch, you might spot where it is.

-Adrian

On 5/9/2013 10:42 AM, Hans Bakker wrote:
> Currently there is a problem in the findshipping screen at: 
> https://localhost:8443/facility/control/FindShipment, the list is 
> empty although there are shipments.
>
> When i replace the delegator.find with a delegator.findList it works 
> again.
> The code gets smaller however i can imagine the delegator.find is used 
> in other places?
>
> could it be caused by the recent refactoring?
>
> the diff to replace find with findList:
> Index: 
> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
> ===================================================================
> --- 
> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy 
> (revision 1480573)
> +++ 
> applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy 
> (working copy)
> @@ -132,25 +132,15 @@
>          lowIndex = viewIndex * viewSize + 1;
>          highIndex = (viewIndex + 1) * viewSize;
>          findOpts.setMaxRows(highIndex);
> -
> +        findOpts.setOffset(lowIndex);
> +
>          if (!orderReturnValue) {
> -            // using list iterator
> -            orli = delegator.find("Shipment", mainCond, null, null, 
> orderBy, findOpts);
> -
> -            shipmentListSize = orli.getResultsSizeAfterPartialList();
> +            shipmentList = delegator.findList("Shipment", mainCond, 
> null, orderBy, findOpts, false);
> +            shipmentListSize = shipmentList.size();
>              if (highIndex > shipmentListSize) {
>                  highIndex = shipmentListSize;
>              }
> -
> -            // get the partial list for this page
> -            if (shipmentListSize > 0) {
> -                shipmentList = orli.getPartialList(lowIndex, viewSize);
> -            } else {
> -                shipmentList = [] as ArrayList;
> -            }
> -
> -            // close the list iterator
> -            orli.close();
> +
>          }
>
>          if (orderReturnValue) {
> @@ -202,7 +192,7 @@
>          // only commit the transaction if we started one... this will 
> throw an exception if it fails
>          TransactionUtil.commit(beganTransaction);
>      }
> -
> +
>      context.shipmentList = shipmentList;
>      context.listSize = shipmentListSize;
>      context.highIndex = highIndex;