File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Any idea what's going on? NoSuchObjectLocalException

 
Dan Bizman
Ranch Hand
Posts: 387
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a bean "Orders" which has a collection of OrderItem beans. The OrderItem has a compound primary key of: OrderId + ProductId. It also has a quantity attribute.

When i create the orders in an init method, and then check them in that same method, everything is fine.

When I call a "findOrdersByCustomer" method, it finds a collection of orders and then when I'm looping through the OrderItems for the first order, the following occurs:

1. I get the item via iterator.next();
2. I pull the product out of the orderitem via orderItem.getProduct();
3. I print out the primary key for the item via orderItem.getPrimaryKey();
3a. It prints out (for primary key): OrderId[3],ProductId[2]
4. I call orderItem.getQuantity()

At #4, it throws:
javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=OrderId[3],ProductId[2]

What's going on? Just one method call earlier, the object returned that same exact primary key! Does anyone have any idea what I might be doing wrong?

Plus, if I do findByPrimaryKey(), it finds the OrderItem, but again, if I call getQuantity() it throws that same exception! What could be going on here?
[ September 22, 2005: Message edited by: Dan Bizman ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic