On Fri, 2004-10-01 at 21:31, William I. Zumwalt wrote:
> I have a feeling this is goign to be a really stupid
> questions, but I have a session bean that makes a call
> to my DAO's method which queries a database. My
> problems is I'm using XDoclet (and have been for only
> a few weeks) and not sure how to return the Map object
> in my DAO *properly* to my session bean. I know I
> could do this if I wrote the code, but I want to know
> how to do it using XDoclet (which generated all the
> DAO classes) so that I don't have to write all that.
> 
> Any help much appreciated.

If you just want the Map from the Impl class returned as-is, I believe
you could just make the your session bean class' method abstract and
remove its body (I'm pretty sure it will still get picked up as an
@ejb.interface-method).  The returned value should then get passed all
the way through to the caller.

If you actually want to use the returned Map within the method (e.g. to
do some further processing on it and return the results to the caller),
the easiest way is probably add a helper method (which can be made
private and needn't be exposed in the remote interface), move the
@dao.call to that (making it abstract as before) and have your method
call the helper.  The DAO Impl's Map will then get passed back to your
method first, giving you the chance to manipulate it before finally
returning.

And no, it's not a stupid question, it just requires a bit of lateral
thinking.  Perhaps I should copy & paste all this into a HOW-TO for the
docs, so I can close off XDT-43 at last :-)


Andrew.


> --- my session bean 
>    /**
>      *
>      * @ejb.interface-method
>      *      view-type="remote"
>      *
>      * @dao.call
>      *
>      */
>                                                       
>                          
>     public Map getDeviceList() {
>       // This calls the DAO method (as is), but how do I 
>       // grab the return obj from the DAO obj below?
> 
>         return null;
>     }
>                                                       
>                          
> 
> --- this is a class I use which implements the above
> generated DAO classes from XDoclet to handle database
> specifics.
> 
>     ...
>     public Map getDeviceList() throws EJBException {
>         Map devices = new HashMap();
>         // my postgresql specific access code here
>         return devices;
>     }                                                 



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to