Aaron Mulder wrote:
> 
> On Wed, 13 Sep 2000, Rickard [iso-8859-1] �berg wrote:
> > You don't listen Sebastien... we've been over this a thousand times now
> > on the JAWS mailing list... I'm telling you, the findByXX doesn't work
> > anymore because of the JAWS change to use handles instead of pk's for
> > single entity references. Change it back and it will work however.
> >
> > /Rickard
> 
>         Well, truly, findByXX methods should still work *unless XX is a
> dependent EJB* right?  That is, User.findByName(String name) works if
> "name" is a field that corresponds directly to a DB column, but not if
> "name" is itself an EJB that gets stored in the DB as a handle.
> 
> Aaron
> 

Yes it does. 

If "name" is itself an EJB, it gets stored as a handle, and the findByXX
compares the handle in the database with the handle of the finder
argument. (technical reason: JDBCStoreEntityCommand and
JDBCFindByCommand both use JDBCCommand.setParameter, which is where the
conversion ejb->handle is coded).

I've just tested this with:
- SomeEntity has a cmp-field  public OtherEntity otherEntity
- automatically generated finder findByOtherEntity(OtherEntity oe)
works.

The downside ist that the finder argument must be the referenced bean
itself (OtherEntity oe), and not only its pk, which I agree is less user
friendly.

The only thing that doesn't work anymore:
If SomeEntity has a reference to OtherEntity and OtherEntity has a
complex PK, you cannot do a "defined finder" query for SomeEntity on
only a part of the OtherEntity's PK.


Sebastien


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to