0 Replies Latest reply on Nov 19, 2003 7:35 PM by kpdcp

    cmr one to many - I'm stuck!

    kpdcp Newbie

      Has anybody been able to get a CMR one to many working? I'm trying to get it to work but keep getting "foreign key constraint not allowed for this type of data store".

      The relationship is simple, I have two entity beans, person and company and I want to have one to many unidirectional relationship between these two beans. A person has one company, but a company has many persons.

      I want to have a company_id field in my person table that refers to the id field in my company table. Maybe I'm missing something or doing this wrong?

      If somebody could post a working example of one to many unidirectional I'd be mighty grateful. I'm trying to use the foreign-key-mapping rather than relation-table, can you do this with foregin-key-mapping?

      Here's what I have:

      * @return the company the person belongs to
      * @ejb.persistent-field
      * @ejb.persistence
      * column-name="COMPANY_ID"
      * sql-type="integer"
      * jdbc-type="integer"
      * @ejb.interface-method
      * @ejb.relation
      * name="Person-Company"
      * role-name="Person-belongs-to-Company"
      * target-ejb="Company"
      * target-role-name="Company-has-many-Persons"
      * target-multiple="yes"
      * @jboss.relation
      * fk-constraint="true"
      * fk-column="COMPANY_ID"
      * related-pk-field="id"
      public abstract CompanyLocal getCompany();