1 Reply Latest reply on Dec 13, 2005 1:13 PM by Akif

    incomple findby primary key query

    Akif Newbie

      Database MS SQL Server 2000
      Jboss 3.2.7

      I get the following error-
      2005-12-13 12:39:07,303 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.TemplateBean#findByPrimaryKey] Executing SQL: SELECT FROM temp t0_TemplateBean WHERE
      2005-12-13 12:39:07,303 ERROR [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.TemplateBean#findByPrimaryKey] Find failed
      java.sql.SQLException: [SANDPIPER]Incorrect syntax near the keyword 'FROM'.
      at com.inet.tds.a.a(Unknown Source)
      at com.inet.tds.c.byte(Unknown Source)
      at com.inet.tds.c.new(Unknown Source)
      at com.inet.tds.c.executeQuery(Unknown Source)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:314)

      If you look at the generated query , the query is incomplete :SELECT FROM temp t0_TemplateBean WHERE


      ejbjar.xml :
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <enterprise-beans>

      <ejb-name>TemplateBean</ejb-name>
      com.passkey.internal.templates.TemplateHome
      com.passkey.internal.templates.Template
      <ejb-class>com.passkey.internal.templates.TemplateBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Integer</prim-key-class>
      false
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>TemplateCMP</abstract-schema-name>
      <cmp-field><field-name>id</field-name></cmp-field>
      <cmp-field><field-name>applicationId</field-name></cmp-field>

      <primary-field>id</primary-field>



      </enterprise-beans>

      </ejb-jar>

      jbosscmp-jdbc.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC
      "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN"
      "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd">

      <jbosscmp-jdbc>


      java:/LiveresDS
      <datasource-mapping>MS SQLSERVER2000</datasource-mapping>
      <create-table>false</create-table>
      <remove-table>false</remove-table>
      <pk-constraint>true</pk-constraint>
      <preferred-relation-mapping>foreign-key</preferred-relation-mapping>

      <enterprise-beans>

      <ejb-name>TemplateBean</ejb-name>
      <table-name>temp</table-name>
      <cmp-field>
      <field-name>id</field-name>
      <column-name>id</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>applicationId</field-name>
      <column-name>amount</column-name>
      <not-null/>
      </cmp-field>

      </enterprise-beans>
      </jbosscmp-jdbc>