one feature that would be extremelly useful would be to be able to have a finder method that returns a Collection, with a WHERE clause that accepts an indefinite number of PKs. Something that would allow me to do something like:
List pks = new Vector ();
Collection c = myHome.findByPks (pks);
I believe there is already, internally, a method in JBoss that does just that. See:
2003-12-10 10:29:18,852 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MyBean] Executing SQL: SELECT id,name FROM MyBeans WHERE (id=?) OR (id=?) OR (id=?) OR (id=?) OR (id=?)
Note: the number of "OR"s is variable, and depends on the number of elements in the MyBeans table, limited by the configured cache size.
Exposing that as a standard "finder" would allow me, for example, to execute a "select pk FROM" query with arbitrary (dynamic) WHERE and ORDER BY clauses, and use the resulting pk collection to get all the Beans I want in a single DB hit, rather than one by one...
This does not apply just to the PK, BTW, although PKs are the most important. But I could want something like "findByWeekDays (Collection weekdays)".
Let me know,
DynamicQL and ejbSelectGeneric method.