2 Replies Latest reply on Jan 11, 2002 1:01 PM by Tom Mahaffey

    CMP2 : Table not being created

    Åsmund Hjulstad Newbie

      I am having some problems with CMP2.

      I have two beans, AutoNumber, and Customer. (The AutoNumber bean is linked to the Increment table.)

      The two entity beans are in the same jar, with close to identical parts of the deployment-descriptor.

      The Customer table is created, but not the Increment table.

      The error message I get is as follows:

      Executing SQL: CREATE TABLE Increment (name TEXT, value INT4, CONSTRAINT pk_Increment PRIMARY KEY ())

      Could not create table Increment
      java.sql.SQLException: ERROR: parser: parse error at or near ")"

      org.postgresql.Connection.ExecSQL(Connection.java:403)
      org.postgresql.jdbc2.Statement.executeStatement.java:273)
      org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:73)
      org.jboss.resource.adapter.jdbc.local.StatementInPool.executeUpdate(StatementInPool.java:736)
      org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createTable(JDBCStartCommand.java:154)
      org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.execute(JDBCStartCommand.java:78)
      org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:303)
      org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:175)
      org.jboss.ejb.EntityContainer.start(EntityContainer.java:341)
      org.jboss.ejb.Application.start(Application.java:219)
      org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:389)
      org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:312)
      java.lang.reflect.Method.invoke(Native Method)
      com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      org.jboss.deployment.J2eeDeployer.startModules(J2eeDeployer.java:468)
      org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:439)
      org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:203)
      java.lang.reflect.Method.invoke(Native Method)
      com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      org.jboss.deployment.AutoDeployer.deploy(AutoDeployer.java:681)
      org.jboss.deployment.AutoDeployer.run(AutoDeployer.java:325)
      java.lang.Thread.run(Thread.java:484)


      Deployment descriptors:

      <jbosscmp-jdbc>^M
      ^M
      java:/connect/ConnectDS^M
      <type-mapping>PostgreSQL</type-mapping>^M
      <create-table>true</create-table>^M
      <remove-table>true</remove-table>^M
      <pk-constraint>true</pk-constraint>^M
      <relation-mapping-style>foreign-key</relation-mapping-style>^M
      ^M
      ^M
      <enterprise-beans>^M
      ^M
      <ejb-name>AutoNumber</ejb-name>^M
      <table-name>Increment</table-name>^M
      <cmp-field><field-name>value</field-name><column-name>value</column-name></cmp-field>^M
      <cmp-field><field-name>name</field-name><column-name>name</column-name></cmp-field>^M
      ^M
      ^M
      ^M
      <ejb-name>Customer</ejb-name>^M
      <table-name>Customer</table-name>^M
      <cmp-field><field-name>name</field-name><column-name>name</column-name></cmp-field>^M
      <cmp-field><field-name>customerId</field-name><column-name>customer_id</column-name></cmp-field>^M
      <cmp-field><field-name>status</field-name><column-name>status</column-name></cmp-field>^M
      <cmp-field><field-name>contract</field-name><column-name>contract</column-name></cmp-field>^M
      <cmp-field><field-name>adress</field-name><column-name>adress</column-name></cmp-field>^M
      <cmp-field><field-name>contactName</field-name><column-name>contact_name</column-name></cmp-field>^M
      <cmp-field><field-name>contactPhoneNumber</field-name><column-name>contact_phonenum</column-name></cmp-field>^M
      ^M
      </enterprise-beans>^M
      ^M
      </jbosscmp-jdbc>^M


      ^M
      <enterprise-beans>^M
      ^M
      <ejb-name>AutoNumber</ejb-name>^M
      <jndi-name>JBossUtilAutoNumber</jndi-name>^M
      ^M
      ^M
      <ejb-name>Customer</ejb-name>^M
      <local-jndi-name>connect/Customer</local-jndi-name>^M
      ^M
      </enterprise-beans>^M
      ^M


      <ejb-name>Customer</ejb-name>
      CustomerHome
      Customer
      <ejb-class>CustomerBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>CustomerPK</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Customer</abstract-schema-name>
      <cmp-field><field-name>name</field-name></cmp-field>
      <cmp-field><field-name>customerId</field-name></cmp-field>
      <cmp-field><field-name>status</field-name></cmp-field>
      <cmp-field><field-name>contract</field-name></cmp-field>
      <cmp-field><field-name>adress</field-name></cmp-field>
      <cmp-field><field-name>contactName</field-name></cmp-field>
      <cmp-field><field-name>contactPhoneNumber</field-name></cmp-field>
      <prim-key-field>customerId</prim-key-field>



      </enterprise-beans>

      <resource-ref>
      <res-ref-name>mail/Mail</res-ref-name>
      <res-type>javax.mail.Session</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      <assembly-descriptor>
      <security-role>
      <role-name>systemadministrator</role-name></security-role>
      <security-role>
      <role-name>bruker</role-name></security-role>
      <security-role>
      <role-name>regnskap</role-name></security-role>
      <security-role>
      <role-name>everyone</role-name></security-role>

      <container-transaction>

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

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

      </assembly-descriptor>
      </ejb-jar>