1 Reply Latest reply on Feb 20, 2002 8:02 AM by Tadej

    Could not create table

    Tadej Newbie

      Hi,

      I downloaded and builded the sources of the JBoss 3.0 alpha, because I am interested in using the latest CMP2.0 features (CMR).I am still using the default Hypersonic DB (although in the and we will use Oracle) and trying to deploy an application with a simple one-to-many (order-to-service) ralationship. At the end of the deploy I get a message in the server output:

      09:18:40,867 INFO [EnterpriseContextCachePolicy] Cache policy scheduler started
      09:18:41,258 INFO [Order] Created table 'Order' successfully.
      09:18:41,367 INFO [Service] Created table 'Service' successfully.
      09:18:41,367 INFO [J2eeDeployer#Default] Deployed J2EE application: file:/D:/PROJECTS/jboss-all/build/output/jboss-3.0.0alpha/deploy/oss.ear

      The strange thing I realised when checking the server.log is that Order was not created at all (although the server out says so)
      server.log:
      2002-02-20 09:18:41,242 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Order] Executing SQL: CREATE TABLE Order (orderId INTEGER, requestedCompletionDate DATE, orderDate DATE, orderState VARCHAR(256), priority INTEGER, apiClientId VARCHAR(256), actualCompletionDate DATE, orderType VARCHAR(256), description VARCHAR(256), purchaseOrder VARCHAR(256), CONSTRAINT pk_Order PRIMARY KEY (orderId))

      2002-02-20 09:18:41,258 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Order] Could not create table Order

      java.sql.SQLException: Unexpected token: ORDER in statement [CREATE TABLE Order (orderId INTEGER, requestedCompletionDate DATE, orderDate DATE, orderState VARCHAR(256), priority INTEGER, apiClientId VARCHAR(256), actualCompletionDate DATE, orderType VARCHAR(256), description VARCHAR(256), purchaseOrder VARCHAR(256), CONSTRAINT pk_Order PRIMARY KEY (orderId))]
      at org.hsqldb.Trace.getError(Trace.java:180)
      at org.hsqldb.Result.(Result.java:175)
      at org.hsqldb.jdbcConnection.executeHSQL(jdbcConnection.java:907)
      .....................
      I know, that JBoss is not realy a DB creation tool, but any way I think that this should work. Does any one know, what the problem is?

      The eyb-jar.xml is:
      <?xml version="1.0"?>

      <!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>
      The OrderManager and NetworkActivator EJBs represent the manager
      of service orders at the higher and lower level respectively.
      <display-name>Service Provisioning</display-name>

      <enterprise-beans>


      Stores Services
      <display-name>Oss Service</display-name>
      <ejb-name>Service</ejb-name>
      si.marand.oss.serviceprovisioning.ordermanagement.interfaces.service.ejb.Service
      <local-home>si.marand.oss.serviceprovisioning.ordermanagement.interfaces.service.ejb.ServiceHome</local-home>
      <ejb-class>si.marand.oss.serviceprovisioning.ordermanagement.impl.service.ejb.ServiceBean</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>service</abstract-schema-name>

      <cmp-field><field-name>serviceId</field-name></cmp-field>
      <cmp-field><field-name>serviceState</field-name></cmp-field>
      <cmp-field><field-name>subscriberId</field-name></cmp-field>
      <cmp-field><field-name>serviceXmlParams</field-name></cmp-field>
      <cmp-field><field-name>order</field-name></cmp-field>
      <primkey-field>serviceId</primkey-field>



      Stores Orders
      <display-name>Oss Order</display-name>
      <ejb-name>Order</ejb-name>
      si.marand.oss.serviceprovisioning.ordermanagement.interfaces.order.ejb.Order
      <local-home>si.marand.oss.serviceprovisioning.ordermanagement.interfaces.order.ejb.OrderHome</local-home>
      <ejb-class>si.marand.oss.serviceprovisioning.ordermanagement.impl.order.ejb.OrderBean</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>order</abstract-schema-name>

      <cmp-field><field-name>orderId</field-name></cmp-field>
      <cmp-field><field-name>orderType</field-name></cmp-field>
      <cmp-field><field-name>orderState</field-name></cmp-field>
      <cmp-field><field-name>apiClientId</field-name></cmp-field>
      <cmp-field><field-name>description</field-name></cmp-field>
      <cmp-field><field-name>priority</field-name></cmp-field>
      <cmp-field><field-name>requestedCompletionDate</field-name></cmp-field>
      <cmp-field><field-name>actualCompletionDate</field-name></cmp-field>
      <cmp-field><field-name>orderDate</field-name></cmp-field>
      <cmp-field><field-name>purchaseOrder</field-name></cmp-field>
      <primkey-field>orderId</primkey-field>

      </enterprise-beans>

      <assembly-descriptor>

      <container-transaction>

      <ejb-name>Service</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>

      <container-transaction>

      <ejb-name>Order</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>


      <ejb-relation>
      <ejb-relation-name>Order-Service</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>order-has-services</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>Order</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>services</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>service-belongsto-order</ejb-relationship-role-name>
      Many
      <cascade-delete/>
      <relationship-role-source>
      <ejb-name>Service</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>order</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>

      </ejb-relation>


      </ejb-jar>



      Thanks, Tadej.

      PS: What CVS version of the JBoss 3.0 server has the most stable and reliable CMP engine. Which one should I get?

        • 1. Re: Could not create table
          Tadej Newbie

          Problem solved.

          I should have written a jboss specific jbosscmp-jdbc.xml to map the Order bean to a table name that is diferent from ORDER, which is a reserved SQL token. That's why the table was not created.

          Any way the server shouldn't write on the output, that the ORDER was successfully created.

          By, Tadej.