I just noticed that you are working on an example for all of us! :) Do you have this ready, perhaps with the changes below? I got the zip from your site below about an hour ago, and I'm happy to see an example! :)
Thanks, -- -bk Quoting David Jones <[EMAIL PROTECTED]>: > Greg Turner <[EMAIL PROTECTED]> writes: > > > I've gotten many to many relationships to work, so I took a look at > > what you are doing. While I did not take an indepth look at your code, > > I did notice one big difference between our two approaches. Your code > > is trying to do too much, in managing relationship IDs. If you were to > > change your code to my way of doing it, here is what it would look > > like: > > > > Company company = companyHome.create (companyId, name); > > > > Employee employee = employeeHome.create (emailId,email); > > > > company.getEmployees().add (employee); > > Thank you for the idea. I modified my EmployeeBean>>setCompanyId(companyId) > to > follow your suggestion, so rather than a direct: > > employee.setCompany(companyLocal); > > I'm instead doing the more roundabout: > > companyLocal.getEmployees().add(employeeLocal); > > And it works, when called from either ejbPostCreate() or after > create() has returned to the client. > > Thanks a lot. > > > My original setCompany(companyLocal) still looks like it should work and is > more direct. But I'll take anything that works for the moment :-) > > > Another big difference is that I do all the work in a SessionBean, > > which means that it all occurs under the scope of one transaction. > > Whereas, your code does things piece wise in the client, which means > > not under the scope of one transaction. If you were to do it as I > > suggest on the client, it may still not work because of the > > differences in transaction scope. > > The application that I am trying to convert to JBoss does access all > Entities through Session beans. I was just hoping that for a minimal > example the 2 entity beans and client class might be clearer, and it > also matched Tim's original Version2 code example a little closer. > > I had assumed that the greater number of transactions involved by > making multiple calls from the client would only affect the > performance rather than the correctness. Everything seems to work ok > from the client. > > > Hope this has given you some ideas. Please report back any successes. > > > > Greg Turner > > Thanks for the help. I'm hoping that the apparent underlying problems with > setCompany() can be fixed up relatively soon, but at least I can > continue using the add() technique for the moment. > > > > David Jones wrote: > > > 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 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 > -- > 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 > > _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user