3 Replies Latest reply on Oct 14, 2003 8:31 AM by schmidts

    SQL statement does not work

    kkaal

      Hi,

      in a CMP bean, I defined a finder which uses a QL statement.

      The reaction of JBoss:
      16:47:07,277 INFO [STDOUT] Find failed: java.sql.SQLException: Column not found: REGNAME in statement [SELECT t0_udata.id FROM USER_DATA t0_udata WHERE (t0_udata.regname = 'custom' AND t0_udata.password = 'xxxx')]

      If I execute this very statement in the mySQL IDE, it works fine.

      Here the XDoclet defs for this bean:

      --------------------------------------------------
      /**
      * @ejb.bean
      * name="user_data"
      * jndi-name="cosi/userdata"
      * cmp-version="2.x"
      * type="CMP"
      * view-type="remote"
      * description="Entity bean for working with data of user-mgr"
      * primarykey-field="id"
      * schema="alluser"
      *
      * @ejb.value-object
      * name="userobject"
      * match="*"
      *
      * @ejb.ejb-ref
      * ejb-name="user_data"
      * ref-name="ejb/cosi/userdata"
      *
      * @jboss.ejb-ref-jndi
      * jndi-name="cosi/userdata"
      * ref-name="cosi/userdata"
      *
      * @ejb.persistence table-name="usrdata"
      *
      * @jboss.create-table "true"
      *
      * @jboss.remove-table "true"
      *
      * @jboss.tuned-updates "true"
      *
      * @jboss.read-only "true"
      *
      * @jboss.time-out "100"
      *
      * @ejb.finder
      * method-intf="Home"
      * signature="java.util.Collection findByNameAndPassword( java.lang.String regname, java.lang.String pw )"
      * query="SELECT OBJECT(udata) FROM alluser AS udata WHERE ( udata.regname=?1 and udata.password=?2 )"
      *
      **/
      -------------------------------------------------------

      And this is the field-def for that field in question

      -------------------------------------------------------

      /**
      * @ejb.persistence
      * column-name="regname"
      * jdbc-type="VARCHAR"
      * sql-type="varchar(40)"
      * @return
      */
      public abstract java.lang.String getRegname();

      public abstract void setRegname(java.lang.String regname);

      ------------------------------------------------

      What am I doing wrong?

      Thanks for your help

      Klaus

        • 1. Re: SQL statement does not work
          kkaal

          Hi,
          I am really not experienced with JBoss. So, I am not able to interprete the JBoss error statement. Can anybody give me a hint about the meaning?

          Thanks gurus

          Klaus

          • 2. Re: SQL statement does not work
            kkaal

            Hi,

            I hoped that at least somebody would say, that I am doing the right (or wrong) things. From the material, I supplied. I am somewhat helpless. Things dont work, and I do not make a step forward.

            Would be helpful, if somebody said: Can't see a problem.

            Then I would search on other places.

            Thanks

            Klaus

            • 3. Re: SQL statement does not work
              schmidts

              Probably an issue with MySQL being case-sensitive.