Discussions

EJB programming & troubleshooting: how to config cmr fetch group in SUN ONE

  1. how to config cmr fetch group in SUN ONE (1 messages)

    I have a one2many cmr problem. one vendroID has many contact info, when i am deploying the ejb, it throws the following exception

    [25/Feb/2004:10:16:12] WARNING ( 3764): Validation error in bean ContactInfo: The field vendorID has an invalid fetch group. Default is not a valid fetch group for managed fields. If your field is not a managed field, it may be treated as one if you have a CMR to this bean which is mapped to the same column as vendorID.
    Select a different fetch group.

    my sun-cmp-mapping.xml :

          <cmr-field-mapping>
            <cmr-field-name>contactInfo</cmr-field-name>
            <column-pair>
              <column-name>Vendors.VendorID</column-name>
              <column-name>ContactInfo.VendorID</column-name>
            </column-pair>
          </cmr-field-mapping>


    and I find some fetche group configuration in sun one's examples,

          <cmr-field-mapping>
            <cmr-field-name>players</cmr-field-name>
            <column-pair>
              <column-name>TEAM.TEAM_ID</column-name>
              <column-name>TEAMPLAYER.TEAM_ID</column-name>
            </column-pair>
            <column-pair>
              <column-name>TEAMPLAYER.PLAYER_ID</column-name>
              <column-name>PLAYER.PLAYER_ID</column-name>
            </column-pair>
            <fetched-with>
              <none/>
            </fetched-with>
          </cmr-field-mapping>

    could anyboy give me a example how to config it?
    Any response is appreciated.
  2. The error message isn't easy to understand, the first time you see it.

    I will try to clear it up.

    >[25/Feb/2004:10:16:12] WARNING ( 3764): Validation error in bean ContactInfo: >The field vendorID has an invalid fetch group.

    The error concerns the cmp-field vendorID.

    You may want to look at that cmp-field, not the contactInfo cmr-field.

    It is related to the contactInfo cmr-field but not as directly.

    >Default is not a valid fetch group for managed fields. If your
    >field is not a managed field, it may be treated as one if you have
    >a CMR to this bean which is mapped to the same column as vendorID.

    This tries to explain the problem. It is a bit thick, though.

    The message is trying to say, look for a cmp-field vendorID, that is
    mapped to the DB column Vendors.VendorID or ContactInfo.VendorID AND
    change the value of the fetched-with element for that field. If there
    is no fetch-with element associated with that field, you need to add one.

    >Select a different fetch group.

    You can use a level or named-group to specify the value of a fetch group
    in the fetched-with element.

    The dtd for the sun-cmp-mapping.xml file is at http://wwws.sun.com/software/sunone/appserver/dtds/sun-cmp-mapping_1_0.dtd

    vbk