Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

find & Select

 
Suneesh Raman
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. What are the differernce between find and select methods & At what circumstances we use them
2. I have used the EJB-QL
SELECT COUNT(x.messageId) FROM t_message AS x WHERE x.forumId=?1
for the find method
public Integer findNofOfReplays (Integer forumId) throws FinderException;
But I got the following

Bean: MessageLocalEJB
Method: java.lang.Integer findNofOfReplays(java.lang.Integer)
EJBQL: SELECT COUNT(x.messageId) FROM t_message AS x WHERE x.forumId=?1
Error: JDO75333: Invalid return type 'java.lang.Integer' for finder method.

I tried the same query in EJB Select and it's worked


Thanks
Suneesh
 
Yogananth
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suneesh,
As of EJB Spec, find methods (ejbFind...()) can return only Primary Key object or a collection of Primary Keys....

Where as ejbSelect can have return type as any value, which is in your case an integer...
 
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!