You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by si...@apache.org on 2007/04/25 19:20:22 UTC

svn commit: r532412 - in /ofbiz/trunk/applications: order/entitydef/ product/script/org/ofbiz/product/inventory/ product/servicedef/

Author: sichen
Date: Wed Apr 25 10:20:21 2007
New Revision: 532412

URL: http://svn.apache.org/viewvc?view=rev&rev=532412
Log:
Adding a sequenceId field to the OrderItemShipGrpInvRes entity and ordering secondarily by this field when inventory reservations are retrieved in the balanceInventoryItems service, as an aid to prioritizing reservations when a RDBMS (such as MySQL) doesn't support fractional seconds on timestamp fields

Modified:
    ofbiz/trunk/applications/order/entitydef/entitymodel.xml
    ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml
    ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
    ofbiz/trunk/applications/product/servicedef/services_facility.xml

Modified: ofbiz/trunk/applications/order/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel.xml?view=diff&rev=532412&r1=532411&r2=532412
==============================================================================
--- ofbiz/trunk/applications/order/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/order/entitydef/entitymodel.xml Wed Apr 25 10:20:21 2007
@@ -833,6 +833,7 @@
       <field name="createdDatetime" type="date-time"></field>
       <field name="promisedDatetime" type="date-time"></field>
       <field name="currentPromisedDate" type="date-time"></field>
+      <field name="sequenceId" type="numeric"></field> 
       <field name="oldPickStartDate" col-name="PICK_START_DATE" type="date-time"></field> <!-- this is no longer used and is here for migration or whatever if needed -->
       <prim-key field="orderId"/>
       <prim-key field="shipGroupSeqId"/>

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml?view=diff&rev=532412&r1=532411&r2=532412
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml Wed Apr 25 10:20:21 2007
@@ -161,6 +161,7 @@
                             <set from-field="parameters.quantityNotReserved" field="reserveOisgirMap.quantityNotAvailable"/>
                             <set from-field="parameters.reservedDatetime" field="reserveOisgirMap.reservedDatetime"/>
                             <set from-field="promisedDatetime" field="reserveOisgirMap.promisedDatetime"/>
+                            <set from-field="parameters.sequenceId" field="reserveOisgirMap.sequenceId"/>
                             <call-service service-name="reserveOrderItemInventory" in-map-name="reserveOisgirMap"/>
                             <clear-field field-name="reserveOisgirMap"/>
                         <else>
@@ -218,6 +219,7 @@
                             <set from-field="parameters.quantityNotReserved" field="reserveOisgirMap.quantityNotAvailable"/>
                             <set from-field="parameters.reservedDatetime" field="reserveOisgirMap.reservedDatetime"/>
                             <set from-field="parameters.promisedDatetime" field="reserveOisgirMap.promisedDatetime"/>
+                            <set from-field="parameters.sequenceId" field="reserveOisgirMap.sequenceId"/>
                             <call-service service-name="reserveOrderItemInventory" in-map-name="reserveOisgirMap"/>
                             <clear-field field-name="reserveOisgirMap"/>
                         </else>
@@ -265,6 +267,9 @@
                     <set from-field="parameters.reservedDatetime" field="reserveOisgirMap.reservedDatetime"/>
                     <set from-field="promisedDatetime" field="reserveOisgirMap.promisedDatetime"/>
                     <set field="reserveOisgirMap.quantity" value="1" type="Double"/>
+                    <if-not-empty field-name="parameters.sequenceId">
+                        <set field="reserveOisgirMap.sequenceId" from-field="parameters.sequenceId"/>
+                    </if-not-empty>
                     <call-service service-name="reserveOrderItemInventory" in-map-name="reserveOisgirMap"/>
                     <clear-field field-name="reserveOisgirMap"/>
 
@@ -303,6 +308,9 @@
                         <set from-field="parameters.reservedDatetime" field="reserveOisgirMap.reservedDatetime"/>
                         <set from-field="parameters.deductAmount" field="reserveOisgirMap.quantity"/>
                         <set from-field="promisedDatetime" field="reserveOisgirMap.promisedDatetime"/>
+                        <if-not-empty field-name="parameters.sequenceId">
+                            <set field="reserveOisgirMap.sequenceId" from-field="parameters.sequenceId"/>
+                        </if-not-empty>
                         <call-service service-name="reserveOrderItemInventory" in-map-name="reserveOisgirMap"/>
                         <clear-field field-name="reserveOisgirMap"/>
 

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml?view=diff&rev=532412&r1=532411&r2=532412
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml Wed Apr 25 10:20:21 2007
@@ -615,7 +615,8 @@
             <!-- sort the list by date -->
             <string-to-list string="reservedDatetime" list-name="orderByList"/>
             <order-value-list list-name="reservations" order-by-list-name="orderByList"/>
-
+            <set field="orderByList[]" value="sequenceId"/>
+            
             <list-to-list list-name="privilegedReservations" to-list-name="allReservations"/>
             <list-to-list list-name="reservations" to-list-name="allReservations"/>
 
@@ -640,6 +641,7 @@
                 <set from-field="oisgir.reserveOrderEnumId" field="resMap.reserveOrderEnumId"/>
                 <set field="resMap.requireInventory" value="N"/>
                 <set from-field="oisgir.shipGroupSeqId" field="resMap.shipGroupSeqId"/>
+                <set from-field="oisgir.sequenceId" field="resMap.sequenceId"/>
                 <call-service service-name="reserveProductInventory" in-map-name="resMap"/>
                 <clear-field field-name="resMap"/>
             </iterate>

Modified: ofbiz/trunk/applications/product/servicedef/services_facility.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_facility.xml?view=diff&rev=532412&r1=532411&r2=532412
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_facility.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_facility.xml Wed Apr 25 10:20:21 2007
@@ -212,6 +212,7 @@
         <attribute name="reservedDatetime" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="requireInventory" type="String" mode="IN" optional="false"/>
         <attribute name="reserveOrderEnumId" type="String" mode="IN" optional="false"/>
+        <attribute name="sequenceId" type="Long" mode="IN" optional="true"/>
         <attribute name="quantityNotReserved" type="Double" mode="OUT" optional="false"/>
     </service>
     <service name="reserveProductInventoryByFacility" engine="simple"
@@ -229,6 +230,7 @@
         <attribute name="reservedDatetime" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="requireInventory" type="String" mode="IN" optional="false"/>
         <attribute name="reserveOrderEnumId" type="String" mode="IN" optional="true"/>
+        <attribute name="sequenceId" type="Long" mode="IN" optional="true"/>
         <attribute name="quantityNotReserved" type="Double" mode="OUT" optional="false"/>
     </service>
     <service name="reserveProductInventoryByContainer" engine="simple"
@@ -246,6 +248,7 @@
         <attribute name="reservedDatetime" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="requireInventory" type="String" mode="IN" optional="false"/>
         <attribute name="reserveOrderEnumId" type="String" mode="IN" optional="true"/>
+        <attribute name="sequenceId" type="Long" mode="IN" optional="true"/>
         <attribute name="quantityNotReserved" type="Double" mode="OUT" optional="false"/>
     </service>
     <service name="reserveOrderItemInventory" engine="simple"



Re: svn commit: r532412 - in /ofbiz/trunk/applications: order/entitydef/ product/script/org/ofbiz/product/inventory/ product/servicedef/

Posted by Jonathon -- Improov <jo...@improov.com>.
David,

MySQL timestamp resolution is 1 second, I believe.

Also, I think it's not a good practice to index on a timestamp field, and hope that there won't be 
duplicates within the smallest unit of time. It may be silly to think that 2 operations, say 
"Create New Account (with timestamp as part of primary key)", could collide within a single 
nanosecond. Or is it? Will things get easier or worse when you have clustering?

If you still want nanoseconds in the timestamp fields, you'll need to create your own data type 
that is a combination of at least 2 MySQL data types.

Jonathon

David E. Jones wrote:
> 
> On Apr 25, 2007, at 11:20 AM, sichen@apache.org wrote:
> 
>> Author: sichen
>> Date: Wed Apr 25 10:20:21 2007
>> New Revision: 532412
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=532412
>> Log:
>> Adding a sequenceId field to the OrderItemShipGrpInvRes entity and 
>> ordering secondarily by this field when inventory reservations are 
>> retrieved in the balanceInventoryItems service, as an aid to 
>> prioritizing reservations when a RDBMS (such as MySQL) doesn't support 
>> fractional seconds on timestamp fields
> 
> Has anyone looked into doing something with MySQL so that timestamp 
> fields are sub-second? I believe the general SQL convention for this is 
> actually detailed down to nano-seconds. Is there another data type we 
> should be using, or perhaps doing something different with the JDBC driver?
> 
> -David
> 


Re: svn commit: r532412 - in /ofbiz/trunk/applications: order/entitydef/ product/script/org/ofbiz/product/inventory/ product/servicedef/

Posted by Chris Howe <cj...@yahoo.com>.
This is still an open bug for MySQL

http://bugs.mysql.com/bug.php?id=8523


--- "David E. Jones" <jo...@undersunconsulting.com> wrote:

> 
> On Apr 25, 2007, at 11:20 AM, sichen@apache.org wrote:
> 
> > Author: sichen
> > Date: Wed Apr 25 10:20:21 2007
> > New Revision: 532412
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=532412
> > Log:
> > Adding a sequenceId field to the OrderItemShipGrpInvRes entity and 
> 
> > ordering secondarily by this field when inventory reservations are 
> 
> > retrieved in the balanceInventoryItems service, as an aid to  
> > prioritizing reservations when a RDBMS (such as MySQL) doesn't  
> > support fractional seconds on timestamp fields
> 
> Has anyone looked into doing something with MySQL so that timestamp  
> fields are sub-second? I believe the general SQL convention for this 
> 
> is actually detailed down to nano-seconds. Is there another data type
>  
> we should be using, or perhaps doing something different with the  
> JDBC driver?
> 
> -David
> 
> 


Re: svn commit: r532412 - in /ofbiz/trunk/applications: order/entitydef/ product/script/org/ofbiz/product/inventory/ product/servicedef/

Posted by "David E. Jones" <jo...@undersunconsulting.com>.
On Apr 25, 2007, at 11:20 AM, sichen@apache.org wrote:

> Author: sichen
> Date: Wed Apr 25 10:20:21 2007
> New Revision: 532412
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=532412
> Log:
> Adding a sequenceId field to the OrderItemShipGrpInvRes entity and  
> ordering secondarily by this field when inventory reservations are  
> retrieved in the balanceInventoryItems service, as an aid to  
> prioritizing reservations when a RDBMS (such as MySQL) doesn't  
> support fractional seconds on timestamp fields

Has anyone looked into doing something with MySQL so that timestamp  
fields are sub-second? I believe the general SQL convention for this  
is actually detailed down to nano-seconds. Is there another data type  
we should be using, or perhaps doing something different with the  
JDBC driver?

-David


Re: svn commit: r532412 - in /ofbiz/trunk/applications: order/entitydef/ product/script/org/ofbiz/product/inventory/ product/servicedef/

Posted by "David E. Jones" <jo...@undersunconsulting.com>.
On Apr 25, 2007, at 11:20 AM, sichen@apache.org wrote:

> Author: sichen
> Date: Wed Apr 25 10:20:21 2007
> New Revision: 532412
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=532412
> Log:
> Adding a sequenceId field to the OrderItemShipGrpInvRes entity and  
> ordering secondarily by this field when inventory reservations are  
> retrieved in the balanceInventoryItems service, as an aid to  
> prioritizing reservations when a RDBMS (such as MySQL) doesn't  
> support fractional seconds on timestamp fields

Has anyone looked into doing something with MySQL so that timestamp  
fields are sub-second? I believe the general SQL convention for this  
is actually detailed down to nano-seconds. Is there another data type  
we should be using, or perhaps doing something different with the  
JDBC driver?

-David