• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem filling a CMR  RSS feed

 
meka toka
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I have succesfully written an application in pramati studio and deployed it on JBoss. The deployment was successful and client-server communication is also happening.
But the relations are not being set, while the records are being added to the database. I have an Organization EB(entity bean) which has a relation with Departments EB in the cardinality 1->n.
The way i am adding the relation is with the following constraints
* an organization EB has to be created first and then only a department EB can be created
Organization EB record has its fields and an ejb relation called 'depts' which is a collection of the local interfaces of departments EB.
So first i get the Organization EB , then create a Department EB and add its local interface to the collection 'depts'.
These creations are done through a SB, so my ejb-jar.xml has
* ejb_local refs between SB and EB
* relationships are set right in the xml file
The Organization and Department EB's are created but the 'depts' collection stays empty.
What could have gone wrong ?
Thanks in advance
Meka Toka
 
meka toka
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have found the solution to the above problem.
Now i had a Dept EB that had a unidirectional CMR (1:N) with Employee EB. Previously i was doing the following ::
1. create an Employee record
2. get the record of Dept EB, and get the collection of Employees.
3. add the employee record reference to the collection obtained in above step.

But the steps i needed to take care were
--> if the collection of Employees is 'Null' or not
if YES then create a collection, add the reference of Employee to that collection and then set the collection in Dept EB
if NO then get the collection from the Dept EB and add the reference of the Employee EB to the collection

Now at the first thought, the above steps dont make much sense (even now i am like ..??? ) but evidently this is what i found.
I do not know if its a problem with JBoss or something, but if i did code like earlier, i would always have an empty collection.
If anybody can give a proper explanation for this ...i would appreciate it.
Regards
Meka Toka
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!