不知道你是用什么IDE,如果是JB,可能很容易的建立关联.生成的EJB-JAR.XML是这样的格式:
<relationships>
        <ejb-relation>
            <ejb-relation-name>product-productType</ejb-relation-name>
            <ejb-relationship-role>
                <description>product</description>
                <ejb-relationship-role-name>ProductRelationshipRole</ejb-relationship-role-name>
                <multiplicity>Many</multiplicity>
                <relationship-role-source>
                    <description>product</description>
                    <ejb-name>Product</ejb-name>
                </relationship-role-source>
                <cmr-field>
                    <description>productType</description>
                    <cmr-field-name>productType</cmr-field-name>
                </cmr-field>
            </ejb-relationship-role>
        </ejb-relation>
 </relationships>