Cedric Beust wrote:
>
> > From: A mailing list for Enterprise JavaBeans development
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Dominik Drzewiecki
>
> > Lets assume I am using 1.1 CMP Entity Bean.
> > Is it possible to write finder SQL queries for findXXX() methods
> > which rely on joint table data.
>
> Obviously, yes, you can write any SQL queries you want to fetch information
> from joint tables, but you will need to use BMP if you want to use EJB 1.1.
Corrected statement: Yes, you can fetch information from joined tables. If
you are using WebLogic, you have to use BMP. If you are using any of a number
of other products (or the RI), you can do it directly in SQL.
<vendor> For example, to do what Dominik wants in BAS, you would use pretty
much the SQL Dominik suggested:
SELECT B.BID FROM B, C WHERE B.BID = C.BID AND C.AID = :AID</sql>
(where :AID stands for well-known ID of A table row)
</vendor>
> On top of that, there is no standardized query language for EJB 1.1 CMP, so
> your question could only be answered in the context of a specific server.
Correct. However, let's not confuse whether it can be done (it can), with
whether it is standardized (it's not, in EJB 1.1).
> Should you decide to switch to EJB 2.0, your problem would be solved
> automatically through relationships (whose implementation will typically
> match closely the one you are suggesting with the extra table containing the
> mapping of foreign keys for the two beans taking part in the relationship).
>
> If CMP 2.0 relationships are not powerful enough to address your need, you
> can resort to using EJB-QL, which has the merit to be standardized and
> therefore available on any EJB 2.0 compliant server.
Unfortunately, there is no such thing. Note that the EJB 2.0 spec is not
yet finalized, and therefore there cannot be any "compliant" servers. The
best you can do is use a beta release, which might have support for an older
release of EJB 2.0. This is particularly relevant when it comes to
relationships. For example, BEA provides an early implementation of public
draft 1, where relationships were on dependent objects and remote interfaces.
Unfortunately, in the latest draft of the EJB 2.0 spec, relationships are on
local interfaces. Meaning that any EJBs written against the version of "EJB
2.0" that BEA has been providing for the last 12 months will need to be
significantly rewritten.
In general, I question the user benefit of BEA recommending their current
EJB 2.0 implemenation to customers. Do they really feel that customers like
to rewrite their applications so frequently? Of course, Cedric was not
recommending using WebLogic 6. He was just recommending the use of "any
EJB 2.0 compliant server" ;-)
-jkw
===========================================================================
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".