12 Replies Latest reply on Oct 28, 2004 9:58 AM by Lame Guy

    CMP - failed to retrieve data from database - but NO excepti

    Norman Fung Newbie

      CMP - failed to retrieve data from database - but NO exception..

      Hi, I've developed this simple CMP to retrieve user Group information from database. It failed to retrieve data from database but no exception is thrown (Yes, I stepped through the code, nothing happenned). And now I'm kind of stuck without any error message to start debuggin with. So, I'm just asking for general advice/direction...

      1. CLIENT side
      Here's the Strut's action class ** ie. the CLIENT ** (yes, that's where they retrieve local proxy to CMP directly, as opposed to doing it thru a session bean):

      try {
      ...
      ...
      BasicConfigurator.configure();
      logger.debug("PrepareLoginAction invoked");

      context = new InitialContext();
      Object ref = context.lookup(groupJNDI);
      home = (GroupLocalHome)PortableRemoteObject.narrow(ref, GroupLocalHome.class);

      ******** THAT's MY CMP local proxy: GroupLocal, Nothing is retrieved here by NO EXCEPTION ********
      groups=home.findAllGroups();
      ...
      return mapping.findForward("success");
      ...
      } catch(Exception e) {
      ***** NO EXCEPTION CAUGHT *****
      }

      2. The CMP GroupBean:

      /**
      * @author norman_lm_fung@hotmail.com
      *
      * @ejb.bean
      * name="GroupEJB"
      * local-jndi-name="ejb/UserGroup"
      * display-name="User Group EJB"
      * description="User Group EJB"
      * cmp-version="2.x"
      * type="CMP"
      * view-type="local"
      * schema="Group"
      * reentrant="false"
      * primkey-field="UIN"
      *
      * @ejb.persistence
      * table-name="GROUPS"
      *
      * @ejb.finder
      * query="SELECT OBJECT(g) FROM Group AS g"
      * signature="java.util.Collection findAllGroups()"
      *
      * @ejb.interface
      * local-class="com.aa.samples.interfaces.GroupLocal"
      *
      * @ejb.home
      * local-class="com.aa.samples.interfaces.GroupLocalHome"
      *
      * @jboss.persistence
      * datasource="java:/jdbc/dev01"
      * datasource-mapping="mySQL"
      * create-table="False"
      * remove-table="False"
      * table-name="GROUPS"
      *
      */
      public abstract class GroupBean implements EntityBean {

      protected EntityContext etx;
      protected Logger logger =Logger.getLogger(GroupBean.class);

      /*
      * 1. Implementing Home interface
      */

      /**
      * @param name
      * @ejb.create-method
      */
      public Integer ejbCreate(String name, String description) throws CreateException {
      BasicConfigurator.configure();
      logger.debug("GroupBean.ejbCreate invoked.");

      if(name==null) {
      throw new CreateException("name null");
      }

      setName(name);
      setDescription(description);

      return null;
      }

      public void ejbPostCreate(String name, String description) throws CreateException {
      BasicConfigurator.configure();
      logger.debug("GroupBean.ejbPostCreate invoked.");

      return;
      }

      /*
      * 2. Persistence methods:
      */

      /**
      * @ejb.persistent-field
      * @ejb.persistence
      * column-name="UIN"
      * sql-type="INTEGER"
      * @ejb.pk-field
      * @ejb.interface-method
      */
      public abstract Integer getUIN();

      /**
      * @ejb.interface-method
      */
      public abstract void setUIN(Integer UIN);

      /**
      * @ejb.persistent-field
      * @ejb.persistence
      * column-name="name"
      * sql-type="VARCHAR"
      * @ejb.interface-method
      */
      public abstract String getName();

      /**
      * @ejb.interface-method
      */
      public abstract void setName(String name);

      /**
      * @ejb.persistent-field
      * @ejb.persistence
      * column-name="description"
      * sql-type="VARCHAR"
      * @ejb.interface-method
      */
      public abstract String getDescription();

      /**
      * @ejb.interface-method
      */
      public abstract void setDescription(String description);

      /**
      * @ejb.persistent-field
      * @ejb.persistence
      * column-name="isSuspended"
      * sql-type="TINYINT"
      * @ejb.interface-method
      */
      public abstract Boolean getIsSuspended();

      /**
      * @ejb.interface-method
      */
      public abstract void setIsSuspended(Boolean isSuspended);


      /*
      * 3. Implementing EntityBean interface:
      */
      public void ejbRemove() throws RemoveException {
      BasicConfigurator.configure();
      logger.debug("GroupBean.ejbRemove invoked.");

      return;
      }

      public void ejbLoad() {
      BasicConfigurator.configure();
      logger.debug("GroupBean.ejbLoad invoked.");

      return;
      }

      public void ejbStore() {
      BasicConfigurator.configure();
      logger.debug("GroupBean.ejbStore invoked.");

      return;
      }

      public void ejbActivate() {
      BasicConfigurator.configure();
      logger.debug("GroupBean.ejbActivate invoked.");

      return;
      }

      public void ejbPassivate() {
      BasicConfigurator.configure();
      logger.debug("GroupBean.ejbPassivate invoked.");

      return;
      }

      public void unsetEntityContext() {
      BasicConfigurator.configure();
      logger.debug("GroupBean.unsetEntityContext invoked.");

      etx= null;

      return;
      }

      public void setEntityContext(EntityContext etx) {
      BasicConfigurator.configure();
      logger.debug("GroupBean.setEntityContext invoked.");

      this.etx= etx;

      return;
      }

      }

      Any idea? Thanks in advance!

        • 1. This may help...
          Norman Fung Newbie

          This may help...

          23:15:41,553 INFO [RequestProcessor] Processing a 'POST' for path '/prepareLoginAction'
          23:15:48,368 INFO [STDOUT] 461330 [http-0.0.0.0-8080-Processor25] DEBUG com.aa.samples.actions.PrepareLoginAction - PrepareLoginAction invoked
          ERROR: invalid console appender config detected, console stream is looping23:15:53,559 INFO [STDOUT] 466521 [http-0.0.0.0-8080-Processor25] DEBUG com.aa.samples.beans.GroupBean - GroupBean.setEntityContext invoked.
          23:15:53,561 INFO [STDOUT] 466521 [http-0.0.0.0-8080-Processor25] DEBUG com.aa.samples.beans.GroupBean - GroupBean.setEntityContext invoked.
          23:15:53,566 INFO [STDOUT] 466528 [http-0.0.0.0-8080-Processor25] DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.GroupEJB#findAllGroups - Executing SQL: SELECT t0_g.UIN FROM GROUPEJB t0_g
          23:15:53,568 INFO [STDOUT] 466528 [http-0.0.0.0-8080-Processor25] DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.GroupEJB#findAllGroups - Executing SQL: SELECT t0_g.UIN FROM GROUPEJB t0_g

          ... nothing related to JDBC/exceptions...

          • 2. Re: CMP - failed to retrieve data from database - but NO exc
            Joan Horta  Tosas Novice

            I've seen an error in your code: you try to retrieve a local home interface in the same way you retrieve a remote home interface.
            Your code is:

            context = new InitialContext();
            Object ref = context.lookup(groupJNDI);
            home = (GroupLocalHome)PortableRemoteObject.narrow(ref, groupLocalHome.class);
            

            When you use Local Interfaces, you don't need to narrow the references, just cast them directly, like this:
            context = new InitialContext();
            GroupLocalHome home = (GroupLocalHome) context.lookup(groupJNDI);
            


            I don't know why aren't you getting any exception about this, but I think that this was the reason your app is not working.


            • 3. Re: CMP - failed to retrieve data from database - but NO exc
              Darran Lofthouse Master

              Is the finder method returning you an empty collection?

              If there is no data to be returned returning an empty collection is a valid response as it says that there are no entities.

              • 4. Re: CMP - failed to retrieve data from database - but NO exc
                Norman Fung Newbie

                Thanks guys! I didn't get any notification (email) from your reply (Didnt set the message option - silly me). Sorry for the late response and thanks a lot for the help.

                I'm going to try fix it now, will let update the post as soon as I'm done, probably in a few hours.

                • 5. Re: CMP - failed to retrieve data from database - but NO exc
                  Norman Fung Newbie

                   

                  "darranl" wrote:
                  Is the finder method returning you an empty collection?

                  If there is no data to be returned returning an empty collection is a valid response as it says that there are no entities.


                  No, there's data in the table. I created it by submitting SQL to target MySQL Instance using MySQL Control Center SQL editor panel. I have also tried to intercept SQL to database using http://www.p6spy.com/ - which tells me my CMP isn't sending anything to database.

                  Anyway, I'm going first try what
                  Raist
                  suggested.[/url]

                  • 6. Re: CMP - failed to retrieve data from database - but NO exc
                    Norman Fung Newbie

                     

                    "Raist_Majere" wrote:
                    I've seen an error in your code: you try to retrieve a local home interface in the same way you retrieve a remote home interface.
                    Your code is:
                    context = new InitialContext();
                    Object ref = context.lookup(groupJNDI);
                    home = (GroupLocalHome)PortableRemoteObject.narrow(ref, groupLocalHome.class);
                    

                    When you use Local Interfaces, you don't need to narrow the references, just cast them directly, like this:
                    context = new InitialContext();
                    GroupLocalHome home = (GroupLocalHome) context.lookup(groupJNDI);
                    


                    I don't know why aren't you getting any exception about this, but I think that this was the reason your app is not working.


                    I've just tried correcting my code as suggested, but:

                    Collection groups=null;
                    GroupLocalHome home=null;
                    ...
                    ...
                    try {
                    ...
                    context = new InitialContext();
                    home = (GroupLocalHome) context.lookup(groupJNDI);
                    groups=home.findAllGroups(); //STILL NOTHING RETRIEVED
                    ...
                    } catch(Exception e) {
                     //AND NOTHING CAUGHT HERE!?
                    }
                    


                    According to www.p6spy.com, nothing (SQL queries) was sent to database. Help! I'm deparate!

                    • 7. Re: CMP - failed to retrieve data from database - but NO exc
                      Joan Horta  Tosas Novice

                      I think I've found where your problem really is, but I'm not sure at all...
                      In your bean, you have this tag:

                      * @jboss.persistence
                      * datasource="java:/jdbc/dev01"
                      * datasource-mapping="mySQL"
                      * create-table="False"
                      * remove-table="False"
                      * table-name="GROUPS"
                      

                      Note that you have written "False". I think that it should be "false" instead (it must be a bool, and in Java it's written "true" and "false", all letters in lowercase). So when XDoclet generates the file jbosscmp-jdbc.xml, fails retrieving all your info and table-name defaults to the EJB name ("GROUPSEJB" in your case), as it's shown by this snipplet of the debug trace you wrote:
                      23:15:53,566 INFO [STDOUT] 466528 [http-0.0.0.0-8080-Processor25] DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.GroupEJB#findAllGroups - Executing SQL: SELECT t0_g.UIN FROM GROUPEJB t0_g
                      

                      Try changing this and tell us about the result.


                      • 8. Re: CMP - failed to retrieve data from database - but NO exc
                        Norman Fung Newbie

                        Thanks Raist, I will try it in a few hours. Appreciate it.

                        • 9. Re: CMP - failed to retrieve data from database - but NO exc
                          Darran Lofthouse Master

                          What is the structure of the jar file?

                          Does it contain the jbosscmp-jdbc.xml?

                          What does the jbosscmp-jdbc.xml look like?

                          What happens if you create an entity in code first?

                          • 10. Re: CMP - failed to retrieve data from database - but NO exc
                            Lame Guy Newbie

                            1. TO Raist:

                            I just made the modification, no and much to my dismay, it's not working unfortunately.

                            /**
                             * @author norman_lm_fung@hotmail.com
                             *
                             * @ejb.bean
                             * name="GroupEJB"
                             * local-jndi-name="ejb/UserGroup"
                             * display-name="User Group EJB"
                             * description="User Group EJB"
                             * cmp-version="2.x"
                             * type="CMP"
                             * view-type="local"
                             * schema="Group"
                             * reentrant="false"
                             * primkey-field="UIN"
                             *
                             * @ejb.persistence
                             * table-name="GROUPS"
                             *
                             * @ejb.finder
                             * query="SELECT OBJECT(g) FROM Group AS g"
                             * signature="java.util.Collection findAllGroups()"
                             *
                             * @ejb.interface
                             * local-class="com.aa.samples.interfaces.GroupLocal"
                             *
                             * @ejb.home
                             * local-class="com.aa.samples.interfaces.GroupLocalHome"
                             *
                             * @jboss.persistence
                             * datasource="java:/jdbc/dev01"
                             * datasource-mapping="mySQL"
                             * create-table="false"
                             * remove-table="false"
                             */
                            public abstract class GroupBean implements EntityBean {
                             ...
                             ...
                            }
                            


                            I'm not sure what it is... nothing is going to the database...


                            2. TO darranl:

                            2.1 What is the structure of the jar file?
                            That's a long story, there's:
                            a. EJB jar which contains the EJB implementation as well as META-INF with ejb-jar.xml
                            b. client jar, which includes the interface classes
                            c. WAR, which contains the JSP's, the libraries (ext jars) and the client jar (b).
                            d. EAR, which contains the EJB jar (a) as well as the WAR file (c).

                            I built it with XDoclet - can I send you the stuff by email? Anyway, for your reference - this is part of the documentation:

                            7. Packaging Configurations:
                             7.1 right click project
                             7.2 Add four archives:
                             7.2.1 UserManagementEJB.jar
                             a. add folder: WEB-INF/classes
                             include: com/aa/samples/*.class, com/aa/samples/beans/*.class, com/aa/samples/interfaces/*.class
                             b. add file: META-INF/ejb-jar.xml, prefix: META-INF
                             c. add file: META-INF/jboss.xml, prefix: META-INF
                             7.2.2 UserManagementClient.jar
                             a. add folder: WEB-INF/classes
                             include: com/aa/samples/interfaces/*.class
                             b. add file: META-INF/ejb-jar.xml, prefix: META-INF
                             c. add file: META-INF/jboss.xml, prefix: META-INF
                             7.2.3 UserManagementWeb.war (NOTE: The name of this file must corresponds to that in META-INF/application.xml)
                             a. add folder: WEB-INF
                             include: *.xml,*.tld
                             prefix: WEB-INF
                             b. add folder: pages
                             prefix: pages
                             c. add folder: WEB-INF/classes/resources (this would include the properties files)
                             include: *.*
                             set prefix: WEB-INF/classes/resources
                             d. add folder: WEB-INF/classes
                             set prefix: WEB-INF/classes
                             include: com/aa/samples/actions/*.class, com/aa/samples/forms/*.class
                             e. add folder: WEB-INF/lib, prefix: WEB-INF/lib
                             f. add file: AuthenticationManagerClient.jar, prefix: WEB-INF/lib
                             7.2.4 UserManagement.ear (NOTE: The name of this file must corresponds to that in META-INF/application.xml)
                             a. add file: META-INF/application.xml, prefix: META-INF
                             b. add file: AuthenticationManagerEJB.jar
                             c. add file: AuthenticationManagerWeb.war
                            


                            2.2 Does it contain the jbosscmp-jdbc.xml?
                            Yes, it does, once again, it's XDoclet generated. WAIT! I forgot to include it in the EJB jar file!! GUYS! I'm going to run this test now first!!! What a moron I am!! This should not be forgiven for ages to come!!

                            2.3 What does the jbosscmp-jdbc.xml look like?

                            <?xml version="1.0" encoding="UTF-8"?>
                            <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd">
                            
                            <jbosscmp-jdbc>
                             <defaults>
                             </defaults>
                            
                             <enterprise-beans>
                             <entity>
                             <ejb-name>GroupEJB</ejb-name>
                             <datasource>java:/jdbc/dev01</datasource>
                             <datasource-mapping>mySQL</datasource-mapping>
                             <create-table>false</create-table>
                             <remove-table>false</remove-table>
                             <table-name>GROUPS</table-name>
                             <cmp-field>
                             <field-name>UIN</field-name>
                             <column-name>UIN</column-name>
                             </cmp-field>
                             <cmp-field>
                             <field-name>name</field-name>
                             <column-name>name</column-name>
                             </cmp-field>
                             <cmp-field>
                             <field-name>description</field-name>
                             <column-name>description</column-name>
                             </cmp-field>
                             <cmp-field>
                             <field-name>isSuspended</field-name>
                             <column-name>isSuspended</column-name>
                             </cmp-field>
                             </entity>
                             </enterprise-beans>
                            </jbosscmp-jdbc>
                            


                            btw, I have another BMP that use the same datasource, and I got it working:

                            public class UserBean implements EntityBean {
                            ...
                            protected static final String jdbcJNDI="java:jdbc/dev01";
                            ...
                             public void setEntityContext(EntityContext etx) throws EJBException {
                             try {
                             initEnvReources(); *** SEE NEXT METHOD ***
                             } catch(Exception e) {
                             throw new EJBException(e);
                             }
                            
                             this.etx=etx;
                             BasicConfigurator.configure();
                             logger.debug("UserBean.setEntityContext invoked");
                             }
                            
                             ...
                             ... more stuff ...
                             ...
                            
                             private void initEnvReources() throws Exception {
                            
                             Object ref=null;
                             Context context=null;
                            
                             try {
                            
                             context=new InitialContext();
                             dataSource=(DataSource) context.lookup(jdbcJNDI); *** IT WORKS ie. datasource JNDI name correct ***
                            
                             ref=(Object) context.lookup(userJNDI);
                             userHome = (UserLocalHome)PortableRemoteObject.narrow(ref, UserLocalHome.class);
                             ... more stuff ...
                             } catch(Exception e) {
                             throw e;
                             }
                             ...
                             ...
                            }
                            


                            2.4 What happens if you create an entity in code first?
                            I'm not sure what you mean by that...

                            I'm going to package "jbosscmp-jdbc.xml" in my EJB jar and see if it solves the problem first. (IT SHOULD), and I will let you know if that was it. Thanks! Many thanks, really. Geez... I'm not to be forgiven heading banging on the wall hands waving

                            • 11. Re: CMP - failed to retrieve data from database - but NO exc
                              Lame Guy Newbie

                              1. TO Raist:

                              I just made the modification, no and much to my dismay, it's not working unfortunately.

                              /**
                               * @author norman_lm_fung@hotmail.com
                               *
                               * @ejb.bean
                               * name="GroupEJB"
                               * local-jndi-name="ejb/UserGroup"
                               * display-name="User Group EJB"
                               * description="User Group EJB"
                               * cmp-version="2.x"
                               * type="CMP"
                               * view-type="local"
                               * schema="Group"
                               * reentrant="false"
                               * primkey-field="UIN"
                               *
                               * @ejb.persistence
                               * table-name="GROUPS"
                               *
                               * @ejb.finder
                               * query="SELECT OBJECT(g) FROM Group AS g"
                               * signature="java.util.Collection findAllGroups()"
                               *
                               * @ejb.interface
                               * local-class="com.aa.samples.interfaces.GroupLocal"
                               *
                               * @ejb.home
                               * local-class="com.aa.samples.interfaces.GroupLocalHome"
                               *
                               * @jboss.persistence
                               * datasource="java:/jdbc/dev01"
                               * datasource-mapping="mySQL"
                               * create-table="false"
                               * remove-table="false"
                               */
                              public abstract class GroupBean implements EntityBean {
                               ...
                               ...
                              }
                              


                              I'm not sure what it is... nothing is going to the database...


                              2. TO darranl:

                              2.1 What is the structure of the jar file?
                              That's a long story, there's:
                              a. EJB jar which contains the EJB implementation as well as META-INF with ejb-jar.xml
                              b. client jar, which includes the interface classes
                              c. WAR, which contains the JSP's, the libraries (ext jars) and the client jar (b).
                              d. EAR, which contains the EJB jar (a) as well as the WAR file (c).

                              I built it with XDoclet - can I send you the stuff by email? Anyway, for your reference - this is part of the documentation:

                              7. Packaging Configurations:
                               7.1 right click project
                               7.2 Add four archives:
                               7.2.1 UserManagementEJB.jar
                               a. add folder: WEB-INF/classes
                               include: com/aa/samples/*.class, com/aa/samples/beans/*.class, com/aa/samples/interfaces/*.class
                               b. add file: META-INF/ejb-jar.xml, prefix: META-INF
                               c. add file: META-INF/jboss.xml, prefix: META-INF
                               7.2.2 UserManagementClient.jar
                               a. add folder: WEB-INF/classes
                               include: com/aa/samples/interfaces/*.class
                               b. add file: META-INF/ejb-jar.xml, prefix: META-INF
                               c. add file: META-INF/jboss.xml, prefix: META-INF
                               7.2.3 UserManagementWeb.war (NOTE: The name of this file must corresponds to that in META-INF/application.xml)
                               a. add folder: WEB-INF
                               include: *.xml,*.tld
                               prefix: WEB-INF
                               b. add folder: pages
                               prefix: pages
                               c. add folder: WEB-INF/classes/resources (this would include the properties files)
                               include: *.*
                               set prefix: WEB-INF/classes/resources
                               d. add folder: WEB-INF/classes
                               set prefix: WEB-INF/classes
                               include: com/aa/samples/actions/*.class, com/aa/samples/forms/*.class
                               e. add folder: WEB-INF/lib, prefix: WEB-INF/lib
                               f. add file: AuthenticationManagerClient.jar, prefix: WEB-INF/lib
                               7.2.4 UserManagement.ear (NOTE: The name of this file must corresponds to that in META-INF/application.xml)
                               a. add file: META-INF/application.xml, prefix: META-INF
                               b. add file: AuthenticationManagerEJB.jar
                               c. add file: AuthenticationManagerWeb.war
                              


                              2.2 Does it contain the jbosscmp-jdbc.xml?
                              Yes, it does, once again, it's XDoclet generated. WAIT! I forgot to include it in the EJB jar file!! GUYS! I'm going to run this test now first!!! What a moron I am!! This should not be forgiven for ages to come!!

                              2.3 What does the jbosscmp-jdbc.xml look like?

                              <?xml version="1.0" encoding="UTF-8"?>
                              <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd">
                              
                              <jbosscmp-jdbc>
                               <defaults>
                               </defaults>
                              
                               <enterprise-beans>
                               <entity>
                               <ejb-name>GroupEJB</ejb-name>
                               <datasource>java:/jdbc/dev01</datasource>
                               <datasource-mapping>mySQL</datasource-mapping>
                               <create-table>false</create-table>
                               <remove-table>false</remove-table>
                               <table-name>GROUPS</table-name>
                               <cmp-field>
                               <field-name>UIN</field-name>
                               <column-name>UIN</column-name>
                               </cmp-field>
                               <cmp-field>
                               <field-name>name</field-name>
                               <column-name>name</column-name>
                               </cmp-field>
                               <cmp-field>
                               <field-name>description</field-name>
                               <column-name>description</column-name>
                               </cmp-field>
                               <cmp-field>
                               <field-name>isSuspended</field-name>
                               <column-name>isSuspended</column-name>
                               </cmp-field>
                               </entity>
                               </enterprise-beans>
                              </jbosscmp-jdbc>
                              


                              btw, I have another BMP that use the same datasource, and I got it working:

                              public class UserBean implements EntityBean {
                              ...
                              protected static final String jdbcJNDI="java:jdbc/dev01";
                              ...
                               public void setEntityContext(EntityContext etx) throws EJBException {
                               try {
                               initEnvReources(); *** SEE NEXT METHOD ***
                               } catch(Exception e) {
                               throw new EJBException(e);
                               }
                              
                               this.etx=etx;
                               BasicConfigurator.configure();
                               logger.debug("UserBean.setEntityContext invoked");
                               }
                              
                               ...
                               ... more stuff ...
                               ...
                              
                               private void initEnvReources() throws Exception {
                              
                               Object ref=null;
                               Context context=null;
                              
                               try {
                              
                               context=new InitialContext();
                               dataSource=(DataSource) context.lookup(jdbcJNDI); *** IT WORKS ie. datasource JNDI name correct ***
                              
                               ref=(Object) context.lookup(userJNDI);
                               userHome = (UserLocalHome)PortableRemoteObject.narrow(ref, UserLocalHome.class);
                               ... more stuff ...
                               } catch(Exception e) {
                               throw e;
                               }
                               ...
                               ...
                              }
                              


                              2.4 What happens if you create an entity in code first?
                              I'm not sure what you mean by that...

                              I'm going to package "jbosscmp-jdbc.xml" in my EJB jar and see if it solves the problem first. (IT SHOULD), and I will let you know if that was it. Thanks! Many thanks, really. Geez... I'm not to be forgiven heading banging on the wall hands waving

                              • 12. Re: CMP - failed to retrieve data from database - but NO exc
                                Lame Guy Newbie

                                It worked!!! Did you hear me guys?!! It worked:

                                p6spy capture:

                                1098971495056|-1||resultset|SELECT t0_g.UIN FROM GROUPS t0_g|UIN = 1
                                1098971495057|-1||resultset|SELECT t0_g.UIN FROM GROUPS t0_g|UIN = 2
                                1098971495070|11|0|commit||
                                1098971586031|25|0|statement|SELECT t0_g.UIN FROM GROUPS t0_g|SELECT t0_g.UIN FROM GROUPS t0_g
                                1098971586032|-1||resultset|SELECT t0_g.UIN FROM GROUPS t0_g|UIN = 1
                                1098971586033|-1||resultset|SELECT t0_g.UIN FROM GROUPS t0_g|UIN = 2
                                1098971586040|6|0|commit||
                                


                                Cause of death is that I forgot to include jbosscmp-jdbc.xml in the EJB jar!!

                                Anyway, thankyou guys, thankyou! Appreciate it and really thanks for going over those code fragments I posted in my earlier messages. Thanks!!