Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

MySQL is throwing SQLException when calling create()

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
I am running a simple CMP bean in JBoss.My database is mySQL.When it is executing create(‘P02’ it is giving this exception.
java.sql.SQLException: Syntax error or access violation, message from server: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE paymentID='P02'' at line 1"


This is what I am doing.
My SLSB is calling CMP bean.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">
<jbosscmp-jdbc>
<defaults>
<datasource>java:/MySQLDS</datasource>
<datasource-mapping>mySQL</datasource-mapping>
<create-table>true</create-table>
<remove-table>false</remove-table>
<pk-constraint>true</pk-constraint>
</defaults>
<enterprise-beans>
<entity>
<ejb-name>WalletLocal</ejb-name>
<table-name />
<cmp-field>
<field-name>paymentID</field-name>
<column-name>paymentID</column-name>
</cmp-field>
<cmp-field>
<field-name>userID</field-name>
<column-name>userID</column-name>
</cmp-field>
</entity>
</enterprise-beans>
</jbosscmp-jdbc
<?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>
<session>
<display-name>WalletSession</display-name>
<ejb-name>WalletSession</ejb-name>
<home>com.abc.core.commerce.Wallet.WalletSessionHome</home>
<remote>com.abc.core.commerce.Wallet.WalletSession</remote>
<ejb-class>com.abc.core.commerce.Wallet.WalletSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<ejb-ref-name>ejb/WalletLocal</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>com.abc.core.commerce.Wallet.WalletLocalHome</local-home>
<local>com.abc.core.commerce.Wallet.WalletLocal</local>
<ejb-link>WalletLocal</ejb-link>
</ejb-local-ref>
</session>
<entity>
<display-name>WalletLocal</display-name>
<ejb-name>WalletLocal</ejb-name>
<local-home>com.abc.core.commerce.Wallet.WalletLocalHome</local-home>
<local>com.abc.core.commerce.Wallet.WalletLocal</local>
<ejb-class>com.abc.core.commerce.Wallet.WalletLocalBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>WalletLocal</abstract-schema-name>
<cmp-field>
<field-name>paymentID</field-name>
</cmp-field>
<cmp-field>
<field-name>userID</field-name>
</cmp-field>
<primkey-field>paymentID</primkey-field>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>WalletLocal</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>WalletSession</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
Please tell me where I am going wrong.
Sonu
[ September 05, 2003: Message edited by: Sonu Ghosh ]
[ September 05, 2003: Message edited by: Sonu Ghosh ]
reply
    Bookmark Topic Watch Topic
  • New Topic