-
1. Re: finding only a limited number of beans
foglesa Nov 12, 2001 2:00 PM (in response to christoph)Finders should be called findBy(method_of_finder) hence you should have :
findByRangeSortedByName(params...)
and
ejbfindByRangeSortedByName(params...)
if you want to set the call in the ejb. if you want to use Jboss.xml file then you need to describe the finder there. it still should be findByXxxxxx.
Al -
2. Re: finding only a limited number of beans
foglesa Nov 12, 2001 2:01 PM (in response to christoph)p.s. note that using cmp jboss wont automatically create a finder for you since this is not a findByEntityField type. so you either have to create the ejbfindBy yourself or follow the docks on creating your own.
Should have mentioned that in the other post.
Al -
3. Re: finding only a limited number of beans
christoph Nov 13, 2001 4:22 AM (in response to christoph)Thanks, I implemented your suggested changes (and removed some bugs in my implementation :) and it works now as expected.
Christoph -
4. Re: finding only a limited number of beans
haytona Nov 13, 2001 5:17 PM (in response to christoph)> Thanks, I implemented your suggested changes (and
> removed some bugs in my implementation :) and it
> works now as expected.
Would you mind sharing how you ended up implementing this functionality.
i.e. ejbFindByXXX method or custom JAWS finders?
thanks -
5. Re: finding only a limited number of beans
christoph Nov 14, 2001 7:57 AM (in response to christoph)> > Thanks, I implemented your suggested changes (and
> > removed some bugs in my implementation :) and it
> > works now as expected.
>
> Would you mind sharing how you ended up implementing
> this functionality.
> i.e. ejbFindByXXX method or custom JAWS finders?
>
> thanks
In the EJB I implemented a method
[pre]
public Collection ejbFindByRangeSortedByName(int start, int count) throws FinderException
[/pre]
which returns a collection of primary keys (Integer
in my case). The SQL query I use in this method looks somewhat like
[pre]
"SELECT id FROM userbean ORDER BY name LIMIT "+count+" OFFSET "+start
[/pre]
which works for PostgreSQL. Don't know for other databases (although I would be interested in a database independent way to specify a query like this), but I think there is no standard way to do this.
In the home interface I implemented a method
[pre]
public Collection findByRangeSortedByName(int start, int count) throws FinderException, RemoteException;
[/pre]
No entry in jaws.xml was necessary.
Hope that helps,
Christoph -
6. Re: finding only a limited number of beans
haytona Nov 14, 2001 8:37 PM (in response to christoph)thanks.