Hello Jeff,

EJB QL is not supported yet, the EJB 2.0 PD support is just partial so far.
When EJB QL is available we will announce it.

Regards,
Karl Avedal

Jeff Schnitzer wrote:

> Hello folks.  Once again I have some questions, this time about EJB QL.
>
> The quick version is:  How sophisticated is the current Orion support
> for EJB QL?  I want to define a finder query on a field which is the
> mapping field of a CMR relationship, but it doesn't seem to work.
>
> Here's the long version:
>
> I'm using EJB 2.0 CMR fields to map a relationship between two entity
> beans, called Member and MemberName.  The primary key for the MemberName
> is (not surprisingly) a string, and every Member has a MemberName as
> defined by the following relation:
>
>   <ejb-relation>
>    <ejb-relation-name> Member-canonical-MemberName </ejb-relation-name>
>    <description>
>     This is a unidirectional one-to-one mapping from Member
>     to MemberName.  Members have a single canonical MemberName.
>    </description>
>
>    <ejb-relationship-role>
>     <ejb-relationship-role-name> Member-has-canonical-MemberName
> </ejb-relationship-role-name>
>     <multiplicity> one </multiplicity>
>     <role-source> <ejb-name> MemberEJB </ejb-name> </role-source>
>     <cmr-field> <cmr-field-name> memberName </cmr-field-name>
> </cmr-field>
>    </ejb-relationship-role>
>
>    <ejb-relationship-role>
>     <ejb-relationship-role-name> MemberName-is-canonical-for-Member
> </ejb-relationship-role-name>
>     <multiplicity> one </multiplicity>
>     <role-source> <ejb-name> MemberNameEJB </ejb-name> </role-source>
>    </ejb-relationship-role>
>   </ejb-relation>
>
> Just a quick side-note, which I think was brought up before:  the EJB2.0
> spec (pd2) seems to indicate that the cmr-fields should _not_ also be
> defined as cmp-fields in the entity descriptor.  Orion 1.3.8 seems to
> require this.  In any case...
>
> The table which is created for Member has the memberName field which is
> of course a string (the MemberName's primary key).  Good.  Now I want a
> finder method on MemberHome which is
>
> public Member findByName(String name);
>
> I can imagine two ways of going about this.  The simple one would be to
> pretend that Member's memberName is a cmp-field.  The query would be:
>
>    <query>
>     <query-method>
>      <method-name> ejbFindByName </method-name>
>      <method-params>
>       <method-param> java.lang.String </method-param>
>      </method-params>
>     </query-method>
>     <ejb-ql> FROM MemberEJB memb WHERE memb.memberName = ?1 </ejb-ql>
>    </query>
>
> While this works for actual cmp-fields, this does not seem to work for
> cmr-fields.  Not surprising, since the spec doesn't mention this as an
> option (although it doesn't eliminate it, either).
>
> The "proper" way to write the query, if I'm reading the spec right, is:
>
>    <query>
>     <query-method>
>      <method-name> ejbFindByName </method-name>
>      <method-params>
>       <method-param> java.lang.String </method-param>
>      </method-params>
>     </query-method>
>     <ejb-ql> FROM MemberEJB memb, n IN memb.memberName WHERE n.name = ?1
> </ejb-ql>
>    </query>
>
> But I'm not wholly certain, because all the relational EJB QL examples
> in the spec are for one-to-many relationships, not one-to-one.  In any
> case, when I try this, I get the same results that I do for the first
> query, which is to say wholly incorrect results :-)  The failure mode is
> bad, too; rather than failing to find the Member, it seems to just
> return a random existing Member.
>
> So am I just pushing the edge of Orion's implementation of the EJB2.0
> spec, or am I defining my queries wrong?  If this is heading into
> unimplemented space, should I log bugs in Bugzilla or just assume that
> the authors are busily working on this very problem and don't need yet
> another monkey on their backs?  :-)
>
> Is anyone else working with EJB2.0 beans?
>
> Thanks,
> Jeff Schnitzer
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>


Reply via email to