> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]]On Behalf Of Steve Muench
> Sent: Saturday, May 26, 2001 8:53 AM
> To: [EMAIL PROTECTED]
> Subject: Re: EJB 2.0: ORDER BY clause [was EJB-Spec: Why is List not a
> valid finder return type?]
>
>
> Richard,
>
> | > The issue of ORDER BY raises some interesting issues in this regard:
> | >
> | > Is the semantics of ordering defined by the database semantics (e.g.
> | > SQL semantics) or by Java semantics?  While maintaining Java semantics
> | > would seem desirable, it means that we cannot generally push the
> | > ordering down into the database,
>
> Not pushing it to the database will give horrible performance.

Why?  The container might cache the resulting set after sorting it, and
hence give much better performances for subsequent calls.  Also, the results
are already mapped to Java objects, hence another gain.

There is no absolute answer here, it depends on your application, the typing
system that you want to be used when you sort, the quality of your database
and/of your EJB container, etc...

> This might be a naive-sounding question, but is there any way
> in EJB 2.0 to allow developers to directly use the SQL language
> that many are already familiar with?

I am assuming you mean "SQL instead of EJB-QL", because otherwise the answer
to your question would be BMP.

No, keep in mind the Query Language needs to talk to abstract schemas, which
are different than database schemas, and SQL is not well suited for that
(although it comes close, as the similar syntaxes show).

> EJB 2.0 needs an ability to use the full power of SQL,
> not just EJBQL.

In a majority of cases, this will simply not make sense.  Eventually, you
need to map the SQL results back into an abstract schema (or in other words,
into a world of Java objects).

I agree that the existence of both SQL and EJB-QL is regrettable, but it
cannot be addressed differently as of today.  But the situation might look
less grim to you if you think of a possible future where a bunch of new
query languages have been invented besides SQL and OQL, and where the good
news is:  you don't need to learn them, just keep programming in EJB-QL and
the container will generate the code for you.

--
Cedric

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to