• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem filling a CMR

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic