I have a suggestion for a minor modification I've made to my jBoss sources,
and I'd like to put it out to the group to see what people's opinions are on
making this change to jBoss permanently.

I removed the word "WHERE" from being automatically inserted into custom
finder methods.

What does this do?  Well, it allows simple joins when looking up a record in
the database.  For example, if you wanted a way to lookup a customer's
receipt based on a product code, you can use this finder definition (in a
bean defining a Customer's Order):

        <ejb-name>Receipt</ejb-name>
        ...
      <cmp-field>
          <field-name>orderNumber</field-name>
          <column-name>ORDERNUMBER</column-name>
          <sql-type>INTEGER</sql-type>
          <jdbc-type>INTEGER</jdbc-type>
        </cmp-field>
      <cmp-field>
          <field-name>customerNumber</field-name>
          <column-name>CUSTOMER</column-name>
          <sql-type>INTEGER</sql-type>
          <jdbc-type>INTEGER</jdbc-type>
        </cmp-field>
      <cmp-field>
          <field-name>productCode</field-name>
          <column-name>PRODUCTCODE</column-name>
          <sql-type>INTEGER</sql-type>
          <jdbc-type>INTEGER</jdbc-type>
        </cmp-field>
        ...
      <finder>
          <name>findByProduct</name>
          <query>, PRODUCT WHERE ORDER.PRODUCTCODE=PRODUCT.CODE AND
ORDER.CUSTOMER={0} AND PRODUCT.CODE={1}</query>
          <order></order>
        </finder>

I realize this is cheating, somewhat, but it can help overcome some speed
issues in certain situations by letting the database do some of the work.
I've worked with a couple of EJB containers that allow this, and it has come
in really handy in the past.

Any thoughts?

Sean Bowman
Senior Software Engineer
Webb Interactive, Inc.
[EMAIL PROTECTED]


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

Reply via email to