You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Marcelo Martins <ma...@gmail.com> on 2006/02/01 14:20:29 UTC

Dynamic addMaps

How can i do something like this:

SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader)

sqlMap.addResource("com/foo/mapping/MyMapping.xml");

Please, if is not possible, how can i modify ibatis to do this?

Re: Dynamic addMaps

Posted by Marcelo Martins <ma...@gmail.com>.
Hi Nathan,

I'm creating a corporate framework, and trying to make it more transparent
as possible to the developers.

Here there are many developers in many projects using the same
sqlMapConfig.xml file. This is my problem.

What i liked to do:

When the developer create  a new DAO, (Product for example), the DAO factory
will dinamic add  the mapping file for the DAO (ProductMapping.xml) in the
SqlMapClient.

In the framework, the package of classes and mapping are fixed by rules, and
is easy to found to instance the DAO and to add the mapping.


I'm very happy using iBatis, and this feature will help me a lot.

Thanks

Marcelo Martins


On 2/1/06, Nathan Maves <Na...@sun.com> wrote:
>
> Can you give us a little more information on your problem?
>
> What are you trying to accomplish by using the functionality?
>
> Why would you not just define all of your mappings in the
> sqlMapConfig.xml file?
>
> Nathan
> On Feb 1, 2006, at 6:20 AM, Marcelo Martins wrote:
>
> > How can i do something like this:
> >
> > SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader)
> >
> > sqlMap.addResource("com/foo/mapping/MyMapping.xml");
> >
> > Please, if is not possible, how can i modify ibatis to do this?
>
>

Re: Dynamic addMaps

Posted by Gareth Moorst <ga...@yahoo.co.uk>.
Sorry to butt in, but I'd like to add my tuppence to this thread:

This kind of functionality could be useful for an application I'm writing too - I've got a mammoth
single application jar, distributed via webstart, which I am considering splitting into many
separate jars, by application area. There is no middle tier for this app, it connects to the
database directly, hence the ibatis framework is part of the download.
If I split the single huge jar into a single core app jar (with reusable common sqlmaps) and many
extra application jars (each with specific sqlmaps) then I'll need some way to add mappings to the
sqlmap config dynamically. It is possible that the core jar and any combination of the application
jars could be used at any one time.
I want to avoid having a single 'data access' jar which has sqlmaps for all of the application
areas.

Cheers,
Gareth Moorst.

--- Nathan Maves <Na...@Sun.COM> wrote:

> Can you give us a little more information on your problem?
> 
> What are you trying to accomplish by using the functionality?
> 
> Why would you not just define all of your mappings in the  
> sqlMapConfig.xml file?
> 
> Nathan
> On Feb 1, 2006, at 6:20 AM, Marcelo Martins wrote:
> 
> > How can i do something like this:
> >
> > SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader)
> >
> > sqlMap.addResource("com/foo/mapping/MyMapping.xml");
> >
> > Please, if is not possible, how can i modify ibatis to do this?
> 
> 



		
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com

Re: Dynamic addMaps

Posted by Nathan Maves <Na...@Sun.COM>.
Can you give us a little more information on your problem?

What are you trying to accomplish by using the functionality?

Why would you not just define all of your mappings in the  
sqlMapConfig.xml file?

Nathan
On Feb 1, 2006, at 6:20 AM, Marcelo Martins wrote:

> How can i do something like this:
>
> SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader)
>
> sqlMap.addResource("com/foo/mapping/MyMapping.xml");
>
> Please, if is not possible, how can i modify ibatis to do this?