I located the problem. Probably, it is a JBoss Bug, but I was able to bypass it 
in our code. 
The problem was the following. Within one transaction we created a new entity 
in the OrderService:
...
  | orderEntity = EntityHomeHelper.getOrderHome().create(....); // it is 
important that the madatorname was NOT passed in the create method.
  | orderEntity.setMandatorname(getMandatorName()); // it is set right 
afterwards.
  | ...
Then, in the RequestService - within the same transaction - the following 
finder was used to find the previous created order entity: 
findOrderByOrdernumberAndMandator(java.lang.String,java.lang.String) 
The finder failed as described in the posting.
But, when looking for all orders, the entity was found. 
try {
  |   Collection col = EntityHomeHelper.getOrderHome().findAll();
  |   for (Iterator iter = col.iterator(); iter.hasNext();) {
  |     Order element = (Order) iter.next();
  |     System.out.println("MandatorName: " + element.getMandatorname());
  |   }
  | } catch (FinderException finderException) {
  |    // ignore: it is just for testing
  | }

Thus, I was wrong in the forum posting guessing that JBoss does not look first 
in the bean cache when calling a finder.

What I did to fix the problem is the following. I extended the create method of 
the order entity by mandatorname. If it is passed within the create method and, 
of course, set there by the setMandatorname method, it works as expected. I.e, 
the finder finds the entity created in the transaction.
...
orderEntity = EntityHomeHelper.getOrderHome().create(..., getMandatorName());
  | ...


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084617#4084617

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084617
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to