Small difference in sync order processing between Direct and EJB mode 
----------------------------------------------------------------------

                 Key: DAYTRADER-8
                 URL: http://issues.apache.org/jira/browse/DAYTRADER-8
             Project: DayTrader
          Issue Type: Bug
          Components: EJB Tier
    Affects Versions: 1.1
            Reporter: Christopher James Blythe
            Priority: Minor


I have noticed a slight difference in the behavior of synchronous  buy/sell 
operations between EJB and JDBC mode. For example, in Sync/Direct mode, if you 
perform a buy operation the resulting output of the NewOrder pages will look 
something like the following...

271002          open    2006-07-19 17:04:50.921         null    24.95   buy     
s:0     100.0

If I perform the same operation in Sync/EJB mode, I get the following...

272002          closed          2006-07-19 17:12:25.156         2006-07-19 
17:12:25.156         24.95   buy     s:1     100.0

Notice the differences between the two...
- the status (closed vs. open)
- the completion date (null vs an actual value)

I have looked into the code for this and it seems that the EJB version actually 
returns a refreshed version of the bean (as performed by the ejb container). 
However, in the JDBC/Direct code we perform the necessary updates to the order 
via the order processing apis, but we never update the actual local copy of the 
order bean before returning this.

I realize this may be a minor detail, but it does point out a slight difference 
between the execution of Direct/EJB mode. The simple solution is to re-fetch 
the order data before the buy/sell operations are completed in the 
TradeDirect.java code, similar to the following...


orderData = getOrderData(conn, orderData.getOrderID().intValue());
                        
if (txn != null) {
        if ( Log.doTrace() )
                Log.trace("TradeDirect:sell committing global transaction");    
        
                txn.commit();
                setInGlobalTxn(false);
        }
else    
        commit(conn);

Will attach a patch with this code tomorrow morning...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to