• Post Reply Bookmark Topic Watch Topic
  • New Topic

Missing Entity bean Instances  RSS feed

 
Mark Herschberg
Sheriff
Posts: 6037
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a really bizzare problem. We are writing a trading application. We're using WebLogic 7.0 working against Oracle 9i, both running on Win2000. (We're writing using JBuilder 8 Enterprise--although this shouldn't matter for this problem.)
At the heart of the system is what's known as a limit order book. This is a listing of limit orders (e.g. "buy 1000 shares at $50," "sell 500 shares at $80"). These are placed into the database table for limit orders. When someone comes in with a market order (e.g. "buy 600 shares") it crosses with the sell orders (sorted by price) until it fills the number of shares.
I tested this by hand, meaning I manually placed orders using a gui I created and everything worked fine. All orders got placed, and I can see them printed out on the screen.
Now we've added computer traders, who rapdily place limit orders. Thanks to screen print outs, I can see the orders being placed. All the info is correct. In fact, I can even see the orders in the data base (again, they are entity beans). However when I do a findBy on the entity bean, it does not returnt he complete listing. That is, I might have 10 orders in the database, but the findBy method only returns 2 orders.
Parts of the code is below. I include 4 methods. The method to add the order, the method to print all the orders, a sorting method the latter relies on, and a method to print a collection.

The code in the addLimitOrder seems to work without error. No exceptions are thrown, I see all the printouts, and the order is definately in the database.
The liveOrderHome.findCrossingOrders method is a finder method defined on an entity bean and works as follows:

Again, this works fine when I place the orders myself, by hand.
I haven't a clue what's wrong. It almost feels like the database read is not working (because the code works and the data goes into the database, I just can't find it when doing a find). Could it be caching old reads or something like that? Are there any Oracle or WebLogic settins which might cause this?
I'm lost. Help is greatly appreciated!

--Mark
[ February 05, 2003: Message edited by: Mark Herschberg ]
 
Mark Herschberg
Sheriff
Posts: 6037
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, upon further inspection, my sorting method (new_sortLimitOrders) is killing it. The print statements in the modified method below will print out 20 before hand, and 4 afterwards.

My compareTo method, in the Entity Bean, is

I checked and there is never a case of two equal timestamps, so it's not an issue of duplicate elements.
Does sorting not work well on EJBs? What defines a duplicate value in a TreeSet, is it the same object, or the two objects which return 0 on comparison?
--Mark
[ February 05, 2003: Message edited by: Mark Herschberg ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!