1 Reply Latest reply on Feb 11, 2004 7:21 AM by Behrang Saeedzadeh

    Problem with <preferred-relation-mapping>

    Behrang Saeedzadeh Newbie

      Hi

      I have written a pair of very simple CMP Entity Beans with XDoclet, namely Person and Address and there's a 1-1 unidirectional relationship from a Person to an Address.

      I want the relationship to be created using foreign keys so I have set the preferred-relation-mapping to foreign-key. It works well when I deploy my beans without the JBoss specific deployments descriptors.

      But if I add them to my jar file I see an exception saying that both sides of my relation most have key-fields specified. I can solve that problem by adding the @jboss.relation and @jboss.target-relation tags but the problem is that I don't want to have a separate relation table and I want to use the foreign keys instead.

      Also, the name of the created relation mapping table is very annoying:

      Person4_Address_Address2_Person4_Address. How can I customize that with XDoclet?

      Another problem is that the relation mapping table is not removed whenever I undeploy my beans although that I have specified <remove-table> to be true for both of them. Am I missing something else for that?

      [The name of the beans specified in the ejb-jar.xml are Person4 and Address2 respectively]

      Thanks in advance,
      Behrang S.