3 Replies Latest reply on Jul 3, 2002 1:58 AM by Dain Sundstrom

    can any body solve this problem ?

    jawwad Newbie

      Well i am developing relation between customer and order 1:Many.In order bean i have used un-defined primary mechanism.So it is container generated.The exception is comming i am trying from two days continously but fail to do that
      The exceptions 01:27:40,572 INFO [EjbModule] Deploying OrderEJB
      01:27:43,646 INFO [EjbModule] Created
      01:27:43,657 INFO [EjbModule] Starting
      01:27:43,837 INFO [CustomerEJB] Table 'CUSTOMEREJB' already exists
      01:27:44,147 ERROR [EjbModule] Starting failed
      org.jboss.deployment.DeploymentException: Error while creating table; - nested t
      hrowable: (java.sql.SQLException: Column not found: ) in statement [CREATE TABLE
      ORDEREJB (userID VARCHAR(256), orderEvent BIGINT NOT NULL, netAmount DOUBLE NOT
      NULL, CustomerEJB_orders VARCHAR(256), CONSTRAINT PK_ORDEREJB PRIMARY KEY ())])

      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createTable(JDBCStart
      Command.java:190)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.execute(JDBCStartComm
      and.java:84)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManage
      r.java:383)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManag
      er.java:198)
      at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
      at org.jboss.ejb.Container.invoke(Container.java:793)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:894)
      at $Proxy6.start(Unknown Source)


      //////////////////////////////////////////////////////////

      The same exception comes when i define compound primry key of orderbean.The source code is follow:

      CUSTOMER.JAVA
      ---------------
      package com.ssuet.customer;
      import javax.ejb.*;
      import java.rmi.*;

      public interface Customer extends javax.ejb.EJBObject
      {
      abstract public String getUserID()throws java.rmi.RemoteException;

      abstract public void setName(NameDO name)throws java.rmi.RemoteException;
      abstract public NameDO getName()throws java.rmi.RemoteException;

      abstract public void setUserPwd(String userpwd)throws java.rmi.RemoteException;
      abstract public String getUserPwd()throws java.rmi.RemoteException;

      abstract public void setEmailAddress(String emailaddress)throws java.rmi.RemoteException;
      abstract public String getEmailAddress()throws java.rmi.RemoteException;
      }
      -----------------------------------------------------
      CUSTOMERBEAN.JAVA
      -------------------------------------------------------
      package com.ssuet.customer;
      import java.rmi.*;
      import javax.ejb.*;
      import javax.rmi.*;
      import javax.naming.*;
      import java.util.Collection;



      public abstract class CustomerBean implements javax.ejb.EntityBean{

      public String ejbCreateByUserID(String userid){
      setUserID(userid);
      return null;
      }
      public void ejbPostCreateByUserID(String userid){

      }

      public String ejbCreateByUserIDAndPwd(String userid,String pwd){
      setUserID(userid);
      return null;
      }

      public void ejbPostCreateByUserIDAndPwd(String userid,String pwd){
      setUserPwd(pwd);
      }


      public String ejbCreateByUserInfo(String userid,String pwd,NameDO name,String email){
      setUserID(userid);
      return null;

      }

      public void ejbPostCreateByUserInfo(String userid,String pwd,NameDO name,String email){
      setUserPwd(pwd);
      setName(name);
      setEmailAddress(email);
      }

      public void setName(NameDO name){

      }
      public NameDO getName(){
      return null;
      }

      abstract public void setFirstName(String fname);
      abstract public String getFirstName();

      abstract public void setLastName(String lname);
      abstract public String getLastName();

      abstract public void setUserID(String userid);
      abstract public String getUserID();

      abstract public void setUserPwd(String userpwd);
      abstract public String getUserPwd();

      abstract public void setEmailAddress(String emailaddress);
      abstract public String getEmailAddress();



      abstract public void setOrders(java.util.Collection orders);
      abstract public java.util.Collection getOrders();

      }

      -------------------------------------------------------
      CUSTOMERHOME.JAVA
      ----------------------------------------------------------package com.ssuet.customer;
      import javax.ejb.*;
      import java.rmi.*;


      public interface CustomerHome extends EJBHome
      {

      public Customer createByUserID(String userid)throws CreateException,RemoteException;
      public Customer createByUserIDAndPwd(String userid,String pwd)throws CreateException,RemoteException;
      public Customer createByUserInfo(String userid,String pwd,NameDO name,String email)throws CreateException,RemoteException;
      public Customer findByPrimaryKey(String userid)throws javax.ejb.FinderException;

      }

      ---------------------------------------------------------
      ORDERLOCAL.JAVA

      package com.ssuet.order;
      import javax.ejb.*;

      public interface OrderLocal extends javax.ejb.EJBLocalObject{

      public void setOrderEvent(long date);
      public long getOrderEvent();

      public void setNetAmount(double netamount);
      public double getNetAmount();
      }
      ---------------------------------------------------
      ORDERBEAN.JAVA
      -----------------------------------------------
      import javax.rmi.PortableRemoteObject;

      public abstract class OrderBean implements javax.ejb.EntityBean{

      public Object ejbCreate(String userid,long date,double netamount){
      return null;
      }

      public void ejbPostCreate(String userid,long date,double netamount){
      setUserID(userid);
      setOrderEvent(date);
      setNetAmount(netamount);
      }

      abstract public void setUserID(String userid);
      abstract public String getUserID();

      abstract public void setOrderEvent(long date);
      abstract public long getOrderEvent();

      abstract public void setNetAmount(double netamount);
      abstract public double getNetAmount();
      }
      ------------------------------------------------------
      ORDERHOMELOCAL.JAVA
      --------------------------------------------------
      package com.ssuet.order ;
      import javax.ejb.*;

      public interface OrderHomeLocal extends javax.ejb.EJBLocalHome{

      public OrderLocal create(String userid,long date,double netamount);
      public OrderLocal findByPrimaryKey(java.lang.Object orderkey);

      }

      --------------------------------------------------------
      THE EJB-JAR.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>
      <!--CUSTOMER EJB-->

      <ejb-name>CustomerEJB</ejb-name>
      com.ssuet.customer.Customer
      com.ssuet.customer.CustomerHome
      <ejb-class>com.ssuet.customer.CustomerBean</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>Customer</abstract-schema-name>

      <cmp-field>
      <field-name>firstName</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>lastName</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>userID</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>userPwd</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>emailAddress</field-name>
      </cmp-field>


      <primkey-field>userID</primkey-field>




      <ejb-local-ref>
      <ejb-ref-name>ejb/OrderHomeLocal</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.ssuet.order.OrderHomeLocal</local-home>
      com.ssuet.order.OrderLocal
      <ejb-link>OrderEJB</ejb-link>
      </ejb-local-ref>







      <ejb-name>OrderEJB</ejb-name>
      com.ssuet.order.OrderLocal
      <local-home>com.ssuet.order.OrderHomeLocal</local-home>
      <ejb-class>com.ssuet.order.OrderBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Object</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Order</abstract-schema-name>

      <cmp-field>
      <field-name>userID</field-name>
      </cmp-field>


      <cmp-field>
      <field-name>orderEvent</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>netAmount</field-name>
      </cmp-field>



      </enterprise-beans>

      <ejb-relation>
      <!--One-to-Many Customer-Order-->
      <ejb-relation-name>Customer-Order</ejb-relation-name>

      <!--defining relation ship of customer-->
      <ejb-relationship-role>
      <ejb-relationship-role-name>Customer-has-many-Order-orders</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>CustomerEJB</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>orders</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <!--defining relationship of order-->
      <ejb-relationship-role>
      <ejb-relationship-role-name>order-belongs-to-Customer</ejb-relationship-role-name>
      Many
      <relationship-role-source>
      <ejb-name>OrderEJB</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>



      </ejb-jar>


      Will be vey thank ful if some can solve this.