5 Replies Latest reply on Jun 30, 2002 2:46 PM by Dain Sundstrom

    CMR doesn't work for me.

    Abe Zafar Newbie

      I get the following error when trying to create a bean:

      14:58:04,751 ERROR [entity/License] Could not create entity
      java.sql.SQLException: Unexpected token: / in statement [INSERT INTO LICENSE (id, license_number, entity/User_license) VALUES (1, NULL, NULL)]
      at org.hsqldb.Trace.getError(Trace.java:180)
      at org.hsqldb.Result.(Result.java:175)
      at org.hsqldb.jdbcConnection.executeHSQL(jdbcConnection.java:907)
      at org.hsqldb.jdbcConnection.execute(jdbcConnection.java:718)
      at org.hsqldb.jdbcStatement.fetchResult(jdbcStatement.java:686)
      at org.hsqldb.jdbcStatement.executeUpdate(jdbcStatement.java:85)
      at org.hsqldb.jdbcPreparedStatement.executeUpdate(jdbcPreparedStatement.java:152)
      at org.jboss.resource.adapter.jdbc.local.LocalPreparedStatement.executeUpdate(LocalPreparedStatement.java:308)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.insertEntity(JDBCCreateEntityCommand.java:196)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.execute(JDBCCreateEntityCommand.java:131)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:450)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:253)



      from ejb-jar:
      <ejb-relation>
      <ejb-relation-name>User-License</ejb-relation-name>
      <ejb-relationship-role>
      <ejb-relationship-role-name>user-has-license</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>entity/User</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>license</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>license-belongsto-user</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>entity/License</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>


      from jbosscmp-jdbc.xml

      <ejb-relation>
      <ejb-relation-name>User-License</ejb-relation-name>
      <foreign-key-mapping>
      <ejb-relationship-role>
      <ejb-relationship-role-name>user-has-license</ejb-relationship-role-name>
      <foreign-key-fields/>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>license-belongsto-user</ejb-relationship-role-name>
      <foreign-key-fields>
      <foreign-key-field>
      <field-name>id</field-name>
      <column-name>license_id</column-name>
      </foreign-key-field>
      </foreign-key-fields>
      </ejb-relationship-role>
      </foreign-key-mapping>
      </ejb-relation>


      When I remove this relation from the two xml files the bean is created just fine. Please help because the error does not make much sense at all. I am attaching the xml files as well.

      Thank you,