> >Whilst I've never been in this situation, I've heard many ppl say they've
> >worked at places where thats exactly what happens - the
> >DBA writes some PL/SQL, and the developer calls that.  Isn't that exactly
> >what finders are trying to replace?
>
> Don't know about you org but in mine there are public views and tables that
> any developer or application can use.  Heck, a user can even use SQLPlus
> (Oracle's interactive query utility) to issue any SQL to them.

As I said, I've never been in that situation, but I've heard of it.  Yes, I've worked 
places where I've been able to use SQLPlus to
develop my own queries too (or TOAD :)

> >the same as BMP as I understand it.  THere's nothing to stop you writing
> >your own finder method, all you need to do is return allt
> >he primary keys found - rely on the container to do read-ahead optimization
> >etc, and you have all the flexibility you need...
>
> Could you elaborate further?  What EQL would you specify for the CMP
> findByStatement?  Something like:
>
>    select object(t) from myTable t where ?1
>
> I don't think that will work.  You can only bind values not a part of
> statement.

sorry - no, straight JDBC query....

public Collection ejbFindByWhatever( ... )
  throws FinderException
{
  Connection con = null;
  PreparedStatement pstmt = null;
  ResultSet rs = null;
  try
  {
    con = datasource.getConnection();
    pstmt = con.prepareStatement( ... );
    pstmt.setStringIntWhatever....
    rs = pstmt.executeQuery();
    Collection pks = new ArrayList();
    while (rs.next())
    {
      pks.add(constructPK(rs));
    }
    return pks;
  }
  catch (SQLException e)
  {
    throw new FinderException("SQLException: " + e.getMessage());
  }
  finally
  {
    // cleanup
  }
}

make sense?  I think that should work... from there, the only difference is that 
instead of loading the object yourself, as you
would have without ejbs, you just load the pks, and let the container do the rest.

cheers
dim


}

>
>
> >From: Dmitri Colebatch <[EMAIL PROTECTED]>
> >Reply-To: Dmitri Colebatch <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Re: How many Finders to I need for a search enginer?
> >Date: Sat, 2 Mar 2002 11:16:24 +1100
> >
> > > All these "solutions" would be like a DBA telling people that they can't
> > > issue a query against database, but can only do query through
> >pre-defined
> > > database views.  Sorry, but this is ridiculous.
> >
> >Whilst I've never been in this situation, I've heard many ppl say they've
> >worked at places where thats exactly what happens - the
> >DBA writes some PL/SQL, and the developer calls that.  Isn't that exactly
> >what finders are trying to replace?
> >
> > > What about the query statement?  Should that be in EQL?  Does EJB
> >container
> > > know how to map EQL to target DB during runtime?  If not EQL, wouldn't
> >the
> > > application be not portable?
> >
> >How would you do this in something other than EJB?  you'd basically have a
> >way of constructing the SQL dynamically yes - like the
> >findByStatement.
> >
> > > How would findByStatement work under CMP?
> >
> >the same as BMP as I understand it.  THere's nothing to stop you writing
> >your own finder method, all you need to do is return allt
> >he primary keys found - rely on the container to do read-ahead optimization
> >etc, and you have all the flexibility you need...
> >
> >cheers
> >dim
> >
> >===========================================================================
> >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".
> >
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>

===========================================================================
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".

Reply via email to