In my experience, the where clause is indeed unnecessary in jonas-*.xml, since it would always be the same (where <primaryKey>=?). I have many EJBs, and they all work without an explicit where clause. The only where clauses you need to specify are the other finder methods you create.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 2:50 AM
To: [EMAIL PROTECTED]
Subject: Can WHERE-Clause be omitted in jonas-*.xml for
findByPrimaryKey?
JOnAS docs tell that for each finder the WHERE clause has to be given in the jonas-*.xml descriptor, and that one finder is
mandatory called "findByPrimaryKey". Now I have two questions:
a) It seems that this WHERE clause is not used for findByPrimaryKey, because 1) In the examples it is ommitted, 2) Even if I
write "Bullshit" in the clause, the finder works well, 3) The section for that finder can be called "Bullshit" instead of
"findByPrimaryKey" and the finder works well, 4) There is no information given how the finder relates fields used in the
primary key class to parameters in the WHERE clause (I expect, the left-to-right order given for the parameters in the where
clause now uses the fields top-to-bottom in the primary key).
b) If I can use a PrimaryKeyClass for the parameter of a finder, can this also be done for custom finders, even with CMP? The
intention is to dereference a foreign key automatically.
c) Is it possible to write an EntityBean (CMP) that has fields of type "AnotherEntityBeanPK"? So that I can map relations to
other tables? At the moment this I do this with getting the numeric ID, and then letting the client call a finder on
AnotherEntityBean with that ID. This is not that hard to do, so I thank JOnAS can do this.
