EJB design: CMR Between Beans in Different EJB-Jars

  1. CMR Between Beans in Different EJB-Jars (3 messages)


    I am not sure if this is actually a Design related question. However, here goes. I have designed my application so that I currently have 2 ejb-jars. I am using an IDE for my development, and this IDE (Jbuilder 6) has an EJB Designer. However, the Designer does not seem to allow me to create a relationship between a bean in one ejb-jar and another bean in the other ejb-jar.

    Is this in accordance with the J2EE spec (I cannot seem to find this in the spec), in which case I assume I have to redesign how my beans are partitioned?

    Is it generally good practice to put all beans for one application in one ejb-jar?


  2. Hi,
        You may put all the EJBs in one jar.I prefer this as this reduces the effort for deployment.Java spec doesnt talk abt this.

  3. I'm pretty sure that you can't have relationships between beans in different jars. (I havn't checked the EJB spec though).

    The catch is, the more beans you put in a jar, the longer the jar takes to compile... can't win eh?

  4. Chris,

    The EJB 2.0 spec I believe states that <ejb-relation> elements defined in the DD should refer to beans within the same descriptor. There is no current allowance in the spec with respect to defining relationships across deployment descriptors (or archives).

    So, yes - you'd have to put your EJBs in the same archive in order to define relationships between them. In the case of JBuilder, you can turn off archive creation during the build process (which saves a lot of time). That is, you'd have to explicitly select the EJB module & build it; thus speeding up general development by avoiding unnecessary builds of the module when compiling source files.