Am trying to create 1-to-many bidirectional relation between File and Type entity. The 
relation is, one File has one Type while one Type has many Files. Can someone plz help 
me with this am stuck :-(

This is how I try:

File:

    /**
  |      * @ejb.interface-method
  |      * view-type="local"
  |      *
  |      * @ejb.persistence
  |      * column-name = "typeid"
  |      *
  |      * @ejb.relation
  |      *    name="File-Type"
  |      *    role-name="File-has-Type"
  |      */
  |     public abstract TypeLocal getType();
  |     /**
  |      * @ejb.interface-method
  |      * view-type="local"
  |      */
  |     public abstract void setType(TypeLocal type);



Type:

    public abstract void setName(String name);
  |     /**
  |      * @ejb.interface-method
  |      *    view-type="local"
  |      *
  |      * @ejb.relation
  |      *    name="File-Type"
  |      *    role-name="Type-has-many-File"
  |      *    target-ejb="File"
  |      *    target-multiple="yes"
  |      *    target-role-name="File-has-Type"
  |      *
  |      * @jboss.relation
  |      *    related-pk-field="id"
  |      *    fk-column="typeid"
  |      */
  |     public abstract java.util.Collection getFiles();  
  |     /**
  |      * @ejb.interface-method
  |      *    view-type="local"
  |      */
  |     public abstract void setFiles(java.util.Collection files);

Descripter:
      <ejb-relation >
  |          <ejb-relation-name>File-Type</ejb-relation-name>
  | 
  |          <ejb-relationship-role >
  |             <ejb-relationship-role-name>File-has-Type</ejb-relationship-role-name>
  |             <multiplicity>Many</multiplicity>
  |             <relationship-role-source >
  |                <ejb-name>File</ejb-name>
  |             </relationship-role-source>
  |             <cmr-field >
  |                <cmr-field-name>type</cmr-field-name>
  |             </cmr-field>
  |          </ejb-relationship-role>
  | 
  |          <ejb-relationship-role >
  |             
<ejb-relationship-role-name>Type-has-many-File</ejb-relationship-role-name>
  |             <multiplicity>One</multiplicity>
  |             <relationship-role-source >
  |                <ejb-name>Type</ejb-name>
  |             </relationship-role-source>
  |             <cmr-field >
  |                <cmr-field-name>files</cmr-field-name>
  |                <cmr-field-type>java.util.Collection</cmr-field-type>
  |             </cmr-field>
  |          </ejb-relationship-role>
  | 
  |       </ejb-relation>


This is some of the error I get when deploying:


22:54:58,953 ERROR [URLDeploymentScanner] MBeanException: Exception in MBean ope
ration 'checkIncompleteDeployments()'
Cause: Incomplete Deployment listing:
Packages waiting for a deployer:
  
Incompletely deployed packages:
  
MBeans waiting for classes:
  
MBeans waiting for other MBeans:
[ObjectName: jboss.j2ee:jndiName=InfoType,service=EJB
 state: FAILED
 I Depend On:
 Depends On Me: org.jboss.deployment.DeploymentException: Role: File-has-Type wi
th multiplicity many using foreign-key mapping is not allowed to have key-fields
, ObjectName: jboss.j2ee:jndiName=Streamlog,service=EJB
 state: FAILED
 I Depend On:
 Depends On Me: org.jboss.deployment.DeploymentException: Role: File-has-Type wi
th multiplicity many using foreign-key mapping is not allowed to have key-fields
, ObjectName: jboss.j2ee:jndiName=FileInfo,service=EJB
 state: FAILED


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3822991#3822991

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3822991


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to