Jon, Thanks for your reply.
> 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). Is there another preferred way to post files to this list? > I would be interested to see the EJB-QL you created > in the ejb-jar.xml. Here it is. As you can see, there is no EJB-QL, as findAll() should be auto-generated by the container. <?xml version="1.0"?> <ejb-jar> <display-name>Shirts</display-name> <enterprise-beans> <!-- The primary key field is not specified. This indicates that the primary key is to be generated by the container. author: Matt Munz --> <entity> <description>Models a (T-)Shirt</description> <ejb-name>Shirt</ejb-name> <home>com.apelon.ase.shirts.ShirtHome</home> <remote>com.apelon.ase.shirts.Shirt</remote> <ejb-class>com.apelon.ase.shirts.ShirtBean</ejb-class> <persistence-type>Container</persistence-type> <prim-key-class>java.lang.Object</prim-key-class> <reentrant>False</reentrant> <cmp-field><field-name>name</field-name></cmp-field> <cmp-field><field-name>size</field-name></cmp-field> <cmp-field><field-name>color</field-name></cmp-field> </entity> <session> <description>Models a (T-)Shirt Collection</description> <ejb-name>ShirtCollection</ejb-name> <home>com.apelon.ase.shirts.ShirtCollectionHome</home> <remote>com.apelon.ase.shirts.ShirtCollection</remote> <ejb-class>com.apelon.ase.shirts.ShirtCollectionBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> <ejb-ref> <ejb-ref-name>Shirt</ejb-ref-name> <ejb-ref-type>Entity</ejb-ref-type> <home>com.apelon.ase.shirts.ShirtHome</home> <remote>com.apelon.ase.shirts.Shirt</remote> <ejb-link>Shirt</ejb-link> </ejb-ref> </session> </enterprise-beans> <assembly-descriptor> <container-transaction> <method> <ejb-name>Shirt</ejb-name> <method-name>*</method-name> </method> <trans-attribute>Required</trans-attribute> </container-transaction> </assembly-descriptor> </ejb-jar> > 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. I'm sure that works fine -- thanks for the code. At the moment, however, I am interested in CMP, and the functionality it claims to support. Perhaps there is something wrong with the container (JAWS)? - Matt Munz -----Original Message----- From: Jon Swinth [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 12:16 PM To: Matt Munz Cc: [EMAIL PROTECTED] Subject: RE: [JBoss-user] incorrect SQL generated for findAll() on CMP bean > 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