• 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

Please Help

 
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone please provide a simple example for Entity bean with Container managed relationship.
I tried google search but could not find any example.

Thanks
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please provide one to many relationship example.
Thanks
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The complicated things is not that much in the code but in how to successfully get it deployed. But okay, here is an example on a little bean with CMP for securities (stocks) which I have been able to deploy in the J2EE 1.3 RI app server from Sun.

The home interface:



The business component interface:



And the code for the bean, which is almost empty:



Well, we need a client also to be able to see it really happen when we have got the bean deployed. So here is a little client:



I have got this example to work in the J2EE 1.3 RI app server.

By the way, the named stocks is Swedish stocks
[ June 13, 2007: Message edited by: Jonny Andersson ]
 
Jonny Andersson
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But was it not just a CMP bean you asked for for the first time? If you want some beans with CMR do I think you should start by look into a good book, for example HF EJB, or the J2EE 1.3 tutorial from Sun�s site which have some examples. You find their tutorial here http://java.sun.com/j2ee/tutorial/1_3-fcs/ (which can be found using google and the keywords j2ee 1.3 tutorial )
[ June 14, 2007: Message edited by: Jonny Andersson ]
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jonny for example
But the example which you have posted is for CMP example and i want example with CMR(1:m).
I am studying HFEJB but the example in book is not complete.
I tried Roster Example but i am not able to understand it.

Please help me.
Thanks
 
Jonny Andersson
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is something that I also have been aware of about the HF EJB book, they have too few examples at least too few complete examples! So I read the most of J2EE 1.3 tutorial to get more examples. I don�t remember if I got the Roster example to work or not but I don�t have time to check it now because I have planed to be finished in about two weeks from now and still have much repetition left to do. Maybe did I get some trouble with the RI app server and skipped spend more time on trying to get it to work.

But if you understand CMP well do I suggest that you just read carefully about CMR as the major difference lies in different virtual accessors for CMR and that you have to use local interfaces for the related beans. I can understand you because I also like too really see things I read about and need to memorize working myself and do some hand on. But it takes a lot of time to try out every thing and at some time must the exam be finished. So I hope that reading the details for CMR should be enough.

Sometimes have I wondered why not a site like this one could have a section where someone could put a little working example (that is well commented and with good code!) with a client on every bean type and so on as so many is trying to learn the same thing. I could consider contribute to it myself.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic