ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Lin <rich...@elfly.com>
Subject Re: Adding sqlmap at runtime
Date Thu, 23 Feb 2006 18:05:41 GMT
I can't find the JIRA issue. So here's my attempt.  Opinions, anyone?

A utility class with the following method that takes a  
SqlMapClientImpl and path to sqlmap file to add it into the current  

public static void addMapFromResource(SqlMapClientImpl client, String  
resourcePath) throws NodeletException, IOException {
       Variables v = new Variables();
       v.errorCtx.setActivity("loading the SQL Map resource");
       v.client = client;
       v.delegate = v.client.getDelegate();
       v.typeHandlerFactory = v.delegate.getTypeHandlerFactory();
       v.currentStatements = new HashMap();

       SqlMapParser parser = new SqlMapParser(v);

       Iterator cacheNames = v.client.getDelegate().getCacheModelNames 
       while(cacheNames.hasNext()) {
           String cacheName = (String) cacheNames.next();
           CacheModel cacheModel = v.client.getDelegate 
           Iterator statementNames =  
           while(statementNames.hasNext()) {
               String statementName = (String) statementNames.next();
               MappedStatement statement = (MappedStatement)  
               if(statement!=null) statement.addExecuteListener 

The Variables class inside BaseParser will need an additional variable:

	public Map currentStatements; // NOT currentStatement, which already  

The SqlMapParser's statement nodelets will need the following line at  
the end of process(Node) method:


Am I missing anything?  I haven't tried it yet, but will do as soon  
as I get some free time.


On Feb 23, 2006, at 4:45 AM, Niels Beekman wrote:

> Hi,
> This has been discussed several times now on this mailing list, the
> short answer is no, the longer answer: it is already in JIRA, find the
> issue and vote for it, or even better, contribute it yourself.
> Grtz,
> Niels
> -----Original Message-----
> From: Richard Lin [mailto:richard@elfly.com]
> Sent: donderdag 23 februari 2006 4:56
> To: user-java@ibatis.apache.org
> Subject: Adding sqlmap at runtime
> Is there anyway to add/load a sqlmap XML file at runtime instead of
> including in the sqlmap-config file?
> I'm working on a framework that needs to discover and load sqlmap
> files dynamically from jars with classloader.

View raw message