I am new to both JBoss and EJB2.0 and the new CMP support. Using
XDoclet I can create a couple of beans that include simple CMP and CMR
fields, generate and deploy an ear to JBoss, and it appears to install
it with no WARNings.

But using a simple client I find that the value of my CMR/foreign key
field never changes from null. This is irrespective of whether I set
it in the ejbPostCreate or call it after create() returns to my
client.

I'm assuming it's either a problem with my example or my JBoss configuration. But I
would dearly love to know where the problem is.

Cheers for any help
David Jones


Example showing problem:
------------------------

I have created a minimal example that is reworked from the Version2.zip of Tim
Chartrands "CMP 2.0 With JBoss 3.0 Beta Tutorial".
http://iris.cs.byu.edu/tim/462/tutorial/tutorial.html

Company
  long id                ->CMP & primary key
  String name            ->CMP

Employee
  long id                ->CMP & primary key
  String email           ->CMP
  CompanyLocal company ->CMR field linked to Company 1:M


I have made the example available on my website: 47kb
This includes the source, build.xml and a built ear ready to deploy.

http://www.night.dircon.co.uk/jboss/cmr-example.zip

To try it out:
- Unzip downloaded cmr-example.zip under temp
- Copy dist/cmr-example.ear to
jboss-3.0.0_tomcat-4.0.3/server/default/deploy
- Modify build.xml to point to the installed location of jboss
- ant client

You should see a dialog of the client creating a company, followed by
an employee. Showing that the employees company CMR field has not been
persisted even though it was set in the employees ejbPostCreate.
Then the client will explicitly set the employees company, and for me
at least when asked afterwards the employee still says that its
company is null.

This dialog is included at the end of the email.


Software I'm using:
-------------------

jboss-3.0.0_tomcat-4.0.3
- using unmodified default jboss configuration with hypersonic db
sun jdk 1.4.0-b92
xdoclet 1.1.2
ant 1.4
Win2k fixpack2


Traces from running client:
---------------------------

Client console output on executing: ant client

     [java] --------------------------------------------------
     [java] The aim of this client is to show the CMR field that
     [java] associates the employee with its company is not being
     [java] persisted away during either create or after.
     [java] -- OR --
     [java] It shows gross-user-incompetence on my part, and I would
     [java] like to know what I'm doing wrong.
     [java] [EMAIL PROTECTED]
     [java]
     [java] --------------------------------------------------
     [java] Getting Remote CompanyHome...cmr/CompanyHome
     [java] Getting Remote EmployeeHome...cmr/EmployeeHome
     [java]
     [java] --------------------------------------------------
     [java] Creating company with id=99:name="The BlahBlah Company"...
     [java] Company created!
     [java] Remote Company Details:
     [java]       id=99
     [java]     name="The BlahBlah Company"
     [java]
     [java] --------------------------------------------------
     [java] Creating employee with id=2:email="[EMAIL PROTECTED]":company=cmr/Compan
y:[.99.]...
     [java] Employee created!
     [java] Remote Employee Details:
     [java]           id=2
     [java]        email="[EMAIL PROTECTED]"
     [java]      company=null
     [java]
     [java] At this point employee's company should have been set in ejbPostCrea
te.
     [java] For me it hasn't, as shown above by: company=null
     [java] We will now try to explicitly associate it by setting.
     [java]
     [java] --------------------------------------------------
     [java] Explicitly set company of employee:
     [java] Remote Employee Details:
     [java]           id=2
     [java]        email="[EMAIL PROTECTED]"
     [java]      company=null
     [java]
     [java] On my setup the employee's comany is STILL set to null!!!!


JBoss output on executing: ant client

14:49:52,870 INFO  [MainDeployer] Successfully completed deployment of package: 
file:/D:/jboss/jboss-3.0.0_tomcat-4.0.3/server/default/deploy/cmr-example.ear
14:50:03,235 INFO  [STDOUT] setCompanyById(): key = [.99.]
14:50:03,255 INFO  [STDOUT] setCompanyById(): companyLocal = cmr/CompanyLocal:[.99.]
14:50:03,265 INFO  [STDOUT] setCompanyById(): getCompany() = cmr/CompanyLocal:[.99.]
14:50:03,355 INFO  [STDOUT] getCompanyKey(): companyLocal = null
14:50:03,355 INFO  [STDOUT] getCompanyKey(): Failed to find company associated with 
employee
14:50:03,465 INFO  [STDOUT] setCompanyById(): key = [.99.]
14:50:03,475 INFO  [STDOUT] setCompanyById(): companyLocal = cmr/CompanyLocal:[.99.]
14:50:03,485 INFO  [STDOUT] setCompanyById(): getCompany() = cmr/CompanyLocal:[.99.]
14:50:03,575 INFO  [STDOUT] getCompanyKey(): companyLocal = null
14:50:03,575 INFO  [STDOUT] getCompanyKey(): Failed to find company associated with 
employee

-- 
David G Jones                 [EMAIL PROTECTED]
PGP Key ID=0x389707D3  http://www.night.dircon.co.uk/pgp.asc

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to