It may be useful, but IMO, it really does not belong in a persistence
tool, so yes, resultClass="xml" is going away. Probably not in iBATIS
2.x, but for sure in iBATIS 3.x, though in either case, your project
is safe (what you have works, and you do not have to upgrade).
That said, it is very simple to implement this feature in an efficient
manner by using a RowHandler and a tiny bit of reflection instead of
inserting it into the core. I'd bet that it would end up being just as
fast, and probably using less memory that resultClass="xml" does.
Here is the concept: You create a class that will implement the
RowHandler interface, it has one method:
void handleRow(Object row);
The row parameter will have whatever you want in it (just map it like
you would for use with queryForList or queryForObject), and will get
called once for every row that is returned from your mapped statement,
which you will call with queryWithRowHandler("statement", parms,
yourRowHandlerInstance).
So, in that handleRow method, you will build out your XML document,
using either a Document object, or a StringBuffer (I'd use the
StringBuffer, it would be much faster). You can hard code one if you
want to, or you could build one that uses reflection to get the
element names from the property names.
This would be a great topic for the WIKI if you you have the time.
Larry
On 6/2/06, Morone, Bill <[EMAIL PROTECTED]> wrote:
Larry,
Really? I think it bears great merit. I little expansion would make it really
practical.
In fact hearing of its departure has me a little worried.
Does this mean the resultClass="xml" is going away?
I created a little (restlet front-end) framework that translates the xml output
for web
services. I extended ArrayList to deal with the "non-webformedness" of the
queryForObject "list of little docs" situation and it works great.
Our system is scheduled to go into production in October -- what are the future
plans
for the xml stuff -- I assume we'll have to subclass to extend. Will your
superclass stuff
stay the same?
Bill Morone
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf
Of Larry Meadors
Sent: Thursday, June 01, 2006 4:45 PM
To: [email protected]
Subject: Re: When returning mutiple objects and transforming "directly
to xml
On 6/1/06, Morone, Bill <[EMAIL PROTECTED]> wrote:
> Coming soon, right?
On the contrary, going away.
I'd suggest processing the results of the query manually to create XML
with a row handler if you really need to create xml results.
Larry
This message, including any attachments, is intended only for the recipient(s)
named above. It may contain confidential and privileged information. If you have
received this communication in error, please notify the sender immediately and
destroy or delete the original message. Also, please be aware that if you are
not
the intended recipient, any review, disclosure, copying, distribution or any
action or reliance based on this message is prohibited by law.