0 Replies Latest reply on Jun 10, 2008 3:20 AM by Mallikarjun SG

    throws javax.ejb.RemoveException,javax.ejb.EJBException, cau

    Mallikarjun SG Newbie


      I am getting the following error when trying to use composite primary key for deletion of a record.

      2008-06-10 12:29:36,176 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.RCVlanLoopDetectedTableHome] Executing SQL: SELECT rcVlanLoopDetectedVlanId, rcVlanLoopDetectedPortIndex, rcVlanLoopDetectedValue FROM rcVlanLoopDetectedTable WHERE ()
      2008-06-10 12:29:36,176 ERROR [org.jboss.ejb.plugins.LogInterceptor] EJBException in method: public abstract void javax.ejb.EJBLocalObject.remove() throws javax.ejb.RemoveException,javax.ejb.EJBException, causedBy:
      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 ')' at line 1"

      The code that I have written is:

      primary key class

      public class RCVlanMacTablePK implements Serializable {
       Long rcVlanMacVlanId;
       String rcVlanMacAddr;
       public RCVlanMacTablePK() {
       this.rcVlanMacVlanId = null;
       this.rcVlanMacAddr = null;
       public RCVlanMacTablePK(HashMap<String, Object> values) {
       this.rcVlanMacVlanId = Long.parseLong(values.get("rcVlanMacVlanId")
       this.rcVlanMacAddr = values.get("rcVlanMacAddr").toString();

      In the session facade calling delete method for deleting the record in a table:

       public String delete(HashMap<String, Object> values) {
       try {
       RCVlanMacTablePK pk = pkLoader(values);
       } catch (RemoveException e) {
       log.info("RCVlan: Exception in deleted method " + e);
       } catch (EJBException e) {
       log.info("RCVlan: Exception in deleted method " + e);
       } catch (NumberFormatException e) {
       log.info("RCVlan: Exception in deleted method " + e);
       return str;

      above pkLoader(values) is the method to load the primark key class and passing that primary key class variable to the remove method and calling remove(Object primarykey) method of EJBLocalHome Interface. ie home.remove(pk);

      In the ejb-jar.xml:


      I am getting the above error when executing the same. Please let me what needs to be done for a composite primary key. I am using EJB2.0

      Thank you,