This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to catch EntityNotFoundException

 
Roland Barcia
author
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems that if I execute an EJB 3 query with JBoss and it returns an empty resultset, I cannot catch EntityNotFoundException. It seems that an aspect intercepts somewhere and does not allow me to respond.

I need to be able to detect in the session if the entity exist. If it does I update it. If not, I create a new one. I am testing the if not part but I can never get past EntityNotFoundException even if I catch it from the component calling the query.

Oh horray for aspect
 
norman richards
Author
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean "cannot catch" it? JBoss certainly throws it and it doesn't get caught by anything else. Here's a method I wrote just last week:



I this is the case because I forgot to think about the case when the application starts and there are no inventory items to sum. I was getting EntityNotFoundExceptions.
[ July 26, 2005: Message edited by: norman richards ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic