Hello, ist it possible with EJB 2.0 and 2 EJBs (CMP) with Compound Primary Keays to use a CMR? I tried it with Netbeans 5.5 and JBoss 4.0.4. There I got following error:
| 14:52:27,539 INFO [BaseLocalProxyFactory] Bound EJB | LocalHome 'StoragePoolBean' to jndi 'local/[EMAIL PROTECTED]' | 14:52:27,544 INFO [ProxyFactory] Bound EJB Home 'StoragePoolBean' to | jndi 'StoragePoolBean' | 14:52:27,551 INFO [BaseLocalProxyFactory] Bound EJB | LocalHome 'VirtualVolumeBean' to jndi 'local/[EMAIL PROTECTED]' | 14:52:27,556 INFO [ProxyFactory] Bound EJB Home 'VirtualVolumeBean' to | jndi 'VirtualVolumeBean' | org.jboss.deployment.DeploymentException: Both roles of a relation-table | mapped relationship must have key fields: | ejb-relation-name=SP-contains-VVs | The Beans seem to be o.k., the CMR not. My config: | <?xml version="1.0" encoding="UTF-8"?> | <ejb-jar version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee | http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"> | <display-name>mda2-EJBModule</display-name> | <enterprise-beans> | <entity> | <display-name>StoragePoolEB</display-name> | <ejb-name>StoragePoolBean</ejb-name> | <home>de.virticalsolutions.vdrive.mda.StoragePoolRemoteHome | </home> | <remote>de.virticalsolutions.vdrive.mda.StoragePoolRemote | </remote> | <local-home>de.virticalsolutions.vdrive.mda.StoragePoolLocalHome | </local-home> | <local>de.virticalsolutions.vdrive.mda.StoragePoolLocal | </local> | <ejb-class>de.virticalsolutions.vdrive.mda.StoragePoolBean | </ejb-class> | <persistence-type>Container | </persistence-type> | <prim-key-class>de.virticalsolutions.vdrive.mda.StoragePoolPK | </prim-key-class> | <reentrant>false</reentrant> | <abstract-schema-name>StoragePool</abstract-schema-name> | [...] | </entity> | <entity> | <display-name>VirtualVolumeEB</display-name> | <ejb-name>VirtualVolumeBean</ejb-name> | <home>de.virticalsolutions.vdrive.mda.VirtualVolumeRemoteHome | </home> | <remote>de.virticalsolutions.vdrive.mda.VirtualVolumeRemote | </remote> | <local-home> | de.virticalsolutions.vdrive.mda.VirtualVolumeLocalHome | </local-home> | <local>de.virticalsolutions.vdrive.mda.VirtualVolumeLocal | </local> | <ejb-class>de.virticalsolutions.vdrive.mda.VirtualVolumeBean | </ejb-class> | <persistence-type>Container</persistence-type> | <prim-key-class>de.virticalsolutions.vdrive.mda.VirtualVolumePK | </prim-key-class> | <reentrant>false</reentrant> | <abstract-schema-name>VirtualVolume</abstract-schema-name> | [...] | </entity> | </enterprise-beans> | <relationships> | <ejb-relation> | <description/> | <ejb-relation-name>SP-contains-VVs</ejb-relation-name> | <ejb-relationship-role> | <ejb-relationship-role-name>SPhasVV | </ejb-relationship-role-name> | <multiplicity>One</multiplicity> | <relationship-role-source> | <ejb-name>StoragePoolBean</ejb-name> | </relationship-role-source> | <cmr-field> | <cmr-field-name>virtualVolumes</cmr-field-name> | <cmr-field-type>java.util.Collection</cmr-field-type> | </cmr-field> | </ejb-relationship-role> | <ejb-relationship-role> | <ejb-relationship-role-name>VVinSP | </ejb-relationship-role-name> | <multiplicity>Many</multiplicity> | <relationship-role-source> | <ejb-name>VirtualVolumeBean</ejb-name> | </relationship-role-source> | <cmr-field> | <cmr-field-name>storagePool</cmr-field-name> | </cmr-field> | </ejb-relationship-role> | </ejb-relation> | </relationships> | <assembly-descriptor> | [...] | </assembly-descriptor> | </ejb-jar> | =========================================================================== The Primary Keys have no fields of the same name. I also tried to write the mapping in the jbosscmp-jdbc. As you will see I used e relation-table, no forign key. But with a forign-key I got the same result. Here is my jbosscmp-jdbc.xml: | <jbosscmp-jdbc> | <relationships> | <ejb-relation> | <ejb-relation-name>SP-contains-VVs</ejb-relation-name> | <relation-table-mapping> | <table-name>storagepool_has_virtualvolumes</table-name> | </relation-table-mapping> | <ejb-relationship-role> | <ejb-relationship-role-name>SPhasVV | </ejb-relationship-role-name> | <key-fields> | <key-field> | <field-name>spID</field-name> | <column-name>storagepool</column-name> | </key-field> | <key-field> | <field-name>spSessionID</field-name> | <column-name>storagepool_session</column-name> | </key-field> | </key-fields> | </ejb-relationship-role> | <ejb-relationship-role> | <ejb-relationship-role-name>VVinSP | </ejb-relationship-role-name> | <key-fields> | <key-field> | <field-name>vvID</field-name> | <column-name>virtualvolume</column-name> | </key-field> | <key-field> | <field-name>vvSessionID</field-name> | <column-name>virtualvolume_session</column-name> | </key-field> | </key-fields> | </ejb-relationship-role> | </ejb-relation> | </relationships> | </jbosscmp-jdbc> | =========================================================================== It would be great if someone could explain me what is going wrong here. At the moment I am thinking about not using CMR and make all the relationships on my own. But I don't think that it's a good solution because it would be much more code for me... bests Sascha Effert View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024305#4024305 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024305 _______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
