Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

EJB and CMR questions

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am new to EJB and have questions that pertain to two areas about CMR. The first area is conceptually how the EJBs and related entities are created. The second is about jbosscmp-jdbc.xml
Any help would be greatly appreciated
Reference for questions: BillingEJB has a ContactEJB, it�s a unidirectional one to one relationship
Note*** some of my assumptions maybe wrong to misconfiguration issues with JBoss
In regards to EJB creation and related entities

1.One can have a foreign key to another relation. But to what end? The BillingEJB can have the ContactEJB phone number pk. If I create a BillingEJB and use a �remote� ContactEJB I can only set the foreign key cmp. I cannot set the contact cmr field and the container does not use the foreign key to set it for me. At least when I tested creating an BillingEJB with a remote ContactEJB and trying to get the contacts name I got a null pointer exception because the cmr field was null. Is the foreign key only to aid in the use of �find� and �select� methods?
2.If my assertions are correct in the first question than it follows that the remote interface of an object with cmr relationships is essentially useless. I state this because the only way to set the CMR field is with a local interface in the postCreate method and you can only create a local interface in the container.
3.If my assertions are correct again than some higher level object, a session bean, a delegate, whatever will be required by the client to instantiate any entity beans with cmrs
In regards to jbosscmp-jdbc.xml and maybe this is why I am incurring some of my problems. My relationship from the BillingEJB to the ContactEJB looks like:
<ejb-relationship-role>
<ejb-relationship-role-name>
Billing-Has-Contact
</ejb-relationship-role-name>
<key-fields>
<key-field>
<!-- Note: Field in Billing. -->
<field-name>billingId</field-name>
<!-- Note: Column in Contact table. -->
<column-name>phoneNumber</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
As I understand it the reference EJB is Billing so why do I have specify its key? shouldn't it be something like

<key-fields>
<key-field>
<!-- Note: Field in Billing. -->
<field-name>contactPhoneNumber</field-name> THE FOREIGN KEY
<!-- Note: Column in Contact table. -->
<column-name>phoneNumber</column-name> THE PK in ContactEJB
</key-field>
</key-fields>
 
money grubbing section goes here:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic