>   Also, if anyone has any ideas about how to solve my problem with
> incorrect SQL being generated for findAll(), please share them.  If not, is
> there some other mailing list I should try?

I am not sure why you are having the issue with the findAll() because I was 
unable to view your config (attachments don't work well when emails are 
converted to a digest).  I would be interested to see the EJB-QL you created 
in the ejb-jar.xml.  For now, you can get around the problem by removing the 
ejb-jar.xml configuration and adding a custom finder to the bean file.  Using 
a custom finder has an added benefit of being able to specify an ORDER BY, 
which EJB-QL does not support.

Since this is a common practice for me, I have a static helper method that 
all the beans use.  Here is what I add to the bean class:

  public Collection ejbFindByAll() {
    String sqlText = "SELECT user_group_no, name "
                   + "  FROM user_group "
                   + " ORDER BY name " ;
    return Global.ejbFind(sqlText) ;
  } //end ejbFindByAll()

And here is the static helper method:

  public static Vector ejbFind(
      String                           sqlText ) {
    Connection connection = null ;
    Statement s = null ;
    ResultSet rs = null ;
    Vector items = new Vector();
    try {
      DataSource dataSource = (DataSource)(new 
InitialContext()).lookup(Global.DATA_SOURCE_NAME) ;
      connection = dataSource.getConnection() ;
      s = connection.createStatement();
      rs = s.executeQuery(sqlText) ;
      while (rs.next()) {
        items.add(new Integer(rs.getInt(1)));
      } //end while
      rs.close();
      s.close();
      connection.close();
      return items ;
    } catch (Exception e) {
      System.out.println(sqlText);
      DBUtil.close(rs);
      DBUtil.close(s);
      DBUtil.close(connection);
      throw new EJBException(e);
    } //end try
  } //end ejbFind()


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to