You can define a ResultObjectFactory in the SqlMapClient.

ExtendedSqlMapClient client = (ExtendedSqlMapClient) getObject();

client.getDelegate().setResultObjectFactory(resultObjectFactory);

This factory will then be used by iBatis to instantiate all of your ResultMap objects. Take a look at the API documentation.

 

From: Tom Schindl <[EMAIL PROTECTED]> [mailto:Tom Schindl <[EMAIL PROTECTED]>]
Sent: Friday, June 29, 2007 8:03 AM
To: [email protected]
Subject: Define Factory to instantiate Objects?

Hi,

is it possible to teach iBatis to use a Factory-method to instatiate a
class? In my case the constructor is protected (or even better the
specified type is an interface) and the objects are normally
instantiated using a Factory (for those interested I'm working with
Objects generated from Eclipse EMF).

I'd e.g. like to say

-----------8<-----------
alias="Client"
type="at.bestsolution.model.IClient"
factory="MyModelFactory.createClient" />
-----------8<-----------

Please note also that in this case IClient is an Interface and the
Factory will take care to create the appropriate real implementation
(ClientImpl).

Tom

Reply via email to