Not sure what you mean by user filter. Do you mean you want your finder to return limited results based on user input? Or based on the user identity?
I mean limited results based on user input,
eg. on client side:
String query = "age > 15"; // client generates query dynamicaly
PeopleHome h = ... // obtain home of PeopleEntityBean which has a persistent attribute "age"
Collection beans = h.findByQuery(query);
I do something similar to this, but I have developed a reflection framework and utilize a HashMap value object that allows my client side to know what properties are available from a given bean. I couldn't find anything for free in the EJB spec to satisfy this need.
This is on the features list, but is a very low priority. In the mean time, I suggest that you write a BMP style cutom finder. Just declare your finder in the home and then provide an implementation in you bean implementation class. The method is named ejbFind(your args). This is a pain because you have to write some JDBC code, but usually an application only needs a couple of dynamic finders.
I have a similar problem. I also use Hashtable structure for passing flexible parameters to my finder... I've written this finder using JDBC. I create the statement, get some ResultSet and return a collection of primary keys... This works for my BMP beans, but not for CMP2.0 beans. What kind of data is the BMP style finder in a CMP bean expected to return and how can I transform the primary keys into that? Can someone help me?
Best regards and thanks
Sorry, I found, what was wrong, just a few minutes after posting the yester post. I implemented the custom finder as a home method, ie. ejbHomeFindByAnything, instead of ejbFindByAnything, and so the container didn't transform the returned primary keys into proxies... Now it works fine :o) Mea culpa :o)