- This topic has 5 replies, 2 voices, and was last updated 20 years, 4 months ago by support-michael.
-
AuthorPosts
-
navisMemberhi,
I have 2 ( for example) ejb jars packaged into a single EAR file.
1. ProductEJB.jar ( with entities Product, Category)
2. OrderEJB.jar (with entities OrderItem, Orders)Now, i have a unidirectional relation OrderItem-Product where each item refers to one of the products.
According to EJB specs, the entities for which are involved in the relation using cmr-field MUST be in same DD (ejb-jar.xml).
But the problem is i have those 2 separate modules and whe i “run xdoclet” it generates ejb-jar.xml (and jboss.xml, jbosscmp-jdbc.xml) in module specific META-INF.
How can i generate common DD files for all modules?
Needless to say, if, with your help, i generate my DD file in say OrderEJB.jar module. Then META-INF directory of ProductEJB.jar will be empty. Will it be recognized as valid EJB module by the EJB container?
BTW purely from ejb’s viewpoint. Why is this weird requirement? It completely thwarts the possibility of independent module development.
Any help is appreciated.
support-michaelKeymasterI’m not an expert at CMR but will take a shot at this. Maybe collectively we, including other readers of this thread, can figure this out.
According to EJB specs, the entities for which are involved in the relation using cmr-field MUST be in same DD (ejb-jar.xml).
The EJB2 spec enables ejb-jar to reference the EJB’s declared by another ejb-jar, see section 20.3.2 for a discussion and examples for use of <ejb-ref> and <ejb-link>. Based on 1st principles defined in the spec inter-module EJB references are doable.
With this understanding the question is how to tell Xdoclet to support an external entity reference. I believe the next step is to checkout the tag ejb:ejb-external-ref at
http://docs.codehaus.org/display/XDOCLET/EjbTags. Give it a try and see if the ejb-jar.xml gets generated correctly.
navisMemberYou can refer to enterprise beans in other jar files BUT the beans which are involved in a relation using CMR fields have to be in single jar file. I have tested this in Jboss 3.2.3.
Whatever those issues are all ok. May be I should just DUMP all those ENTITY beans and rather shift to hibernate or ibatis 😉
Let’s shift to MyEclipse now. In MyEclipse i have created 2 EJB modules. I wish to create a single ejb-jar.xml for both modules. How can i do it from MyEclipse (or xdoclet if so)?
support-michaelKeymasterYou can refer to enterprise beans in other jar files BUT the beans which are involved in a relation using CMR fields have to be in single jar file. I have tested this in Jboss 3.2.3.
It was hard for me to accertain this from the spec. But I can clearly see the practical wisdom of packaging related/coupled EJBs in a common module.
In MyEclipse i have created 2 EJB modules. I wish to create a single ejb-jar.xml for both modules. How can i do it from MyEclipse (or xdoclet if so)?
Not sure this is a valid objective as each module has its own ejb-jar.xml deployment descriptor. I would assume the modules offer unique services that will result in each module requiring its own unique deployment descriptor.
Can you describe what you are trying to accomplish with the single deployment descriptor and how you expect it to work?
navisMemberhi,
Ok. Let’s take an example.
Assume i have Customer module and Orders module.
Customer module provides profile registration and auth services.
Orders module manages new orders, their payments and invoicing etc.Now, natually Orders belong to Customers. So i need to relate them. And i want to relate them using CMR.
If i want to do so, i need to club entity beans of both customer and order in one ejb-jar.xml file.Hope i make it clear. Theortically, i agree with your point that 1 ejb-jar.xml should belong to one ejb module. But here is just another pain of living with practical requirements.
support-michaelKeymasteri need to club entity beans of both customer and order in one ejb-jar.xml file.
The above statement translates into you must package both order and customer into a common EJB jar in order for a common ejb-jar.xml to apply.
EJB module = Jar file with /META-INF/ejb-jar.xml
If this is not your objective then you are describing two EJB modules and each will need to have its own unique deployment descriptor (ejb-jar.xml). But you already stated that JBoss requires CMR beans to be in the same module (i.e., the same Jar file).
ME’s EJB Module Projects are designed to contain all of the beans for a single module. If you have split them up then ME doesn’t known how to merge them back into a common ejb jar at deployment time.
Thoughts?
-
AuthorPosts