• Post Reply Bookmark Topic Watch Topic
  • New Topic

Finder query return type..?  RSS feed

 
swati jain
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using a session bean ProcessBean and an entity bean AlarmBean....
where one of functions processor() of ProcessDataBean is like......
processor()
{
println(.a..);
println(..b.);
correlate();
println(.c..);
}
And correlator() is like:-
correlator()
{
println(..d.);
AlarmBeanLocal l = finder query();
println(.e..);
if(l != null)
{
println(.m..)
}
else
{
println(.n..)
}
}
Finder query returns the reference to the entity bean's local interface.......and depending on whether find is successful or not....I've to print m or n....
Now the problem is whenever find is successful.......e, then m and then c gets printed......
but when finder query is not successful, e and n doesn't get printed....and directly c gets printed...it means finder query is directly returning control to the previous function(processor where c is getting printed) .......
I'm not getting whr. is the problem....
in the condition l != null......?
Plz. help me out...
All the declarations in local and home interfaces and ejb-jar is correct.......and my jar file is deployed successfully.....but the output is not correct.....
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finder methods should throw a FinderException for single entity finders if the object is not found.
 
Idly Vada
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by swati jain:

surround
AlarmBeanLocal l = finder query();
with try - catch construct and catch FinderException
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!