2 Replies Latest reply on Oct 22, 2004 6:48 AM by abbasta

    createException problem

    skaari

      Hello
      I really don't know what I'm doing wrong, but I get the following createException():

      Does anybody know what I'm doing wrong?

      13:42:07,375 ERROR [ServerSettingsEJB] Could not create entity
      java.sql.SQLException: Column count does not match in statement [INSERT INTO SERVERSETTINGSEJB (id, smtpServer, popAuthentication, popServer, popUserName, popPassword) VALUES (?, ?, ?, ?, ?, ?)]


      I have the following code:

      public abstract class ServerSettingsBean implements EntityBean {

      public String ejbCreate(String smtpServer,String popAuthentication, String popServer, String popUserName, String popPassword) throws CreateException{ setId(KeyGenerator.getNewKey());
      setSmtpServer(smtpServer);
      setPopAuthentication(popAuthentication);
      setPopServer(popServer);
      setPopUserName(popUserName);
      setPopPassword(popPassword);
      return null;
      } (and of course according postcreate())

      // key manipulation methods
      public abstract String getId();
      public abstract void setId(String id);

      // persistent fields
      public abstract String getSmtpServer();
      public abstract void setSmtpServer( String smtpServer );

      public abstract String getPopServer();
      public abstract void setPopServer( String popServer );

      public abstract String getPopUserName();
      public abstract void setPopUserName( String popUserName );

      public abstract String getPopAuthentication();
      public abstract void setPopAuthentication(String popAuthentication);

      public abstract String getPopPassword();
      public abstract void setPopPassword( String popPassword );

      }


      public interface ServerSettingsHomeLocal extends EJBLocalHome {

      public ServerSettingsLocal create(String smtpServer,String popAuthentication, String popServer, String popUserName, String popPassword) throws CreateException;


      <ejb-name>ServerSettingsEJB</ejb-name>
      <local-home>org.bfh.hti.ben.ejb.ServerSettingsHomeLocal</local-home>
      org.bfh.hti.ben.ejb.ServerSettingsLocal
      <ejb-class>org.bfh.hti.ben.ejb.ServerSettingsBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      false
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>ServerSettings</abstract-schema-name>
      <cmp-field>
      <field-name>id</field-name>
      </cmp-field>
      <cmp-field>
      <description xml:lang="de">no description
      <field-name>smtpServer</field-name>
      </cmp-field>
      <cmp-field>
      <description xml:lang="de">no description
      <field-name>popAuthentication</field-name>
      </cmp-field>
      <cmp-field>
      <description xml:lang="de">no description
      <field-name>popServer</field-name>
      </cmp-field>
      <cmp-field>
      <description xml:lang="de">no description
      <field-name>popUserName</field-name>
      </cmp-field>
      <cmp-field>
      <description xml:lang="de">no description
      <field-name>popPassword</field-name>
      </cmp-field>
      <primkey-field>id</primkey-field>
      <security-identity>
      <use-caller-identity/>
      </security-identity>



        • 1. Re: createException problem
          skaari

          It looks that I've found a bug in 4.0.0

          If I use MySQL as database works my code perfectly !!!

          Is that a bug or is there still something wrong in my code?

          • 2. Re: createException problem
            abbasta

            Delete the table in HSQL which corresponds to your bean, and redeploy. The table is probably generated by some older version of your bean and does not have suitable number of columns.