On Mon, 2005-04-18 at 05:50, William Irving Zumwalt wrote:
> Hey all,
> 
> I found this in an old email and was wondering if someone could
> clarify how this is done. This is exactly what I want, or am trying to
> do now, but I don't understand how. The pattern below was a question
> from Sun's DAO's.
> 
>    "The other difference between Sun's pattern and our generated code
> is that rather than using Data Transfer Objects (see below) to pass
> the fields' values around between the EJB and DAO, we just have the
> EJB pass a reference to itself to the DAO; your DAO Impl classes can
> then use that reference to call the fields' getters & setters as
> necessary."

I suspect it was me in that email, and I think I was talking mainly
about the auto-generated calls for the load/store/create/finder
methods.  However...

> How can I have the EJB pass a ref to itself to the DAO? An example or
> any help would be much appreciated.

As a quick guess, try this

...
/** @ejb.interface-method */
public my.ReturnType someMethod(my.ArgumentType args) {
    return helperMethod(args, this);
}

/** @dao.call */
protected abstract my.ReturnType helperMethod(my.ArgumentType args,
MyBean ejb)
...

The generated DAO interface should contain a helperMethod that takes the
EJB reference, which the generated Session/CMP/BMP subclass for the bean
should delegate to.  I think ;-)  I'd have made the helper private, but
that'd stop the bean class seeing the one in the subclass.  You might
get away with package scope rather than protected, though.

So, tell us, how exactly does XDoclet help you fight the Black League?
Regards to Moira,


Andrew.



-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
_______________________________________________
xdoclet-user mailing list
xdoclet-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to