0 Replies Latest reply on Oct 28, 2004 8:22 AM by kaptajnh

    problem with CMR

    kaptajnh

      Hey everybody
      I have a problem with making my cmr function.
      I have to tables actor and actorrole and I am trying to establish a 1:M relation between them (ActorRole is an associating table between Actor and Role). I have inserted the relevant getters and setters in the two entity beans Actor and ActorRole.

      Getters/Setters in ActorRole:
      public abstract ActorLocal getActor();
      public abstract void setActor(ActorLocal actor);

      Getters/Setters in Actor:
      public abstract Collection getActorRoles();
      public abstract void setActorRoles(Collection actorroles);


      Below are the relevant extractions from the ejb-jar and jbosscmp-jdbc:

      Ejb-jar:
      <ejb-relation >
      <ejb-relation-name>Actor-ActorRole</ejb-relation-name>

      <ejb-relationship-role >
      <ejb-relationship-role-name>ActorRole-belongs-to-Actor</ejb-relationship-role-name>
      Many
      <relationship-role-source >
      <ejb-name>ActorRole</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>actor</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role >
      <ejb-relationship-role-name>Actor-has-many-ActorRoles</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>Actor</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>actorRoles</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>


      jbosscmp-jdbc:

      <ejb-relationship-role>
      <ejb-relationship-role-name>ActorRole-belongs-to-Actor</ejb-relationship-role-name>
      <key-fields/>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Actor-has-many-ActorRoles</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>id</field-name>
      <column-name>actor</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>INTEGER</sql-type>
      </key-field>
      </key-fields>





      When I try to create a ActorRole bean, I get the following error:
      java.sql.SQLException: Column not found message from server: "Unknown column 'actor' in 'field list'"


      It seems like jboss thinks that my cmr field is a cmp field..?! Am i missing something..?

      Thanks in advance for any help!

      Regards
      Rasmus