Well after doing some paying work I'm back to looking at and testing the
new EJB 2.0 query methods. I have taken my current application (not
written in EJB) and tried to convert some of it into EJB. I have come
across the following problems/holes in the EJB/QL spec. Below is a
summary of the key problems with examples. If I'm way off base please
say so!
1. No order clause.
Well ... this is obvious and I have not tested the current stuff to see
if Dain put it in.
2. No limit/offset or cursors.
In a word searches. If you are tring to search for something you display
a list of current values based on a selection criteria. What happens
when the list is 100,000 records. With current DB code you would declare
a cursor or use offset and limits and only retreive a bit at a time.
3. Dynamic where clause
Prompting the user for a search criteria and returning a result set
based on those criteria. Also would be handy to have cursors/limit.
4. database functions
If I am doing a query on a datestamp type field but I only care about
the date part, in postgresql I need to use a postgresql function that
only returns the date.
For 1,3,4 I would propose that we add a special jboss function into the
QL, something like jboss_sql_inline() and what is between the brackets
is just passed through to the sql engine. Arguments could be passed
through to parts of the code with ??1 etc, sort of an escaped argument.
So you could have
select object(o) from foo o where o.id=?1 and
jboss_sql_inline(datefunc(datefield) = ??2)
For option 2 could we not extend the Collection type that we return to
not only do dynamic object creation but also dynamic lookup, so you
would do the query return an empty collection with a handle back to the
query. Once the collection was accessed then the requested element would
be retreived. I beleive this would have to be a read-only list because
if the object is not loaded it can not be locked. This would not be much
of a drawback becuase for searches it is usally read only and then the
users selects an object he wishes to modify/or view the object is locked.
I'm willing to put some time into this. (ie coding)
Comments?
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development