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

    SQL statement does not work

    Klaus Kaal Newbie

      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