BMP EJB Assistance Needed!

Discussions

EJB programming & troubleshooting: BMP EJB Assistance Needed!

  1. BMP EJB Assistance Needed! (1 messages)

    I want to know how do I emplement the ejbFindAll method in my BMP code. My problem is when I get a result set back from the database and want to return it, I want to return the result in an object, not just one string. I would think if I had a Person EJB than I would return multiple person objects but Person (the remote Interface) is an interface, i can't create instances of an interface. Some help please.

    Thanks
    Steve Buster
  2. BMP EJB Assistance Needed![ Go to top ]

    You can return the result in an object form -- try declaring a finder method that returns a collection instead of a single object. The method in the bean class returns a collection of primary key objects, while the method in the home interface actually returns a collection of remote interfaces. The container does the translation between the two for you. Then, the client could just spin through the collection and grab out each object using the interface, which is the standard way you grab back EJBs anyway (you always grab the local or remote interface to work directly with the bean, never the actual bean class).

    If you have access to the Monson-Haefel Enterprise JavaBeans book, check out the Ship EJB example, which does this. I'm sure there are examples on the web as well.

    Mark