Description
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...