ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Young, Alistair" <alistair.yo...@logica.com>
Subject RE: Can I build a SqlMapClient from multiple xml files?
Date Fri, 13 Mar 2009 09:53:33 GMT
I don't believe that iBATIS provides this out of the box.  Maybe
something planned for iBATIS 3?
 
We had a similar requirement and so have written a fairly simple class
to read a SqlMapConfig file into memory, and then insert any required
typehandlers and SQLMaps dynamically (JAXP).  The resulting SqlMapConfig
file can then be fed into iBATIS as usual.
 
This also provides some boons for our testing environment - the
SqlMapConfigBuilder class can root out any SQLMaps/typehandlers that
can't be found on classpath and build a resulting SQLMap that iBATIS
should be guaranteed to process.  Developers working on small subsets of
the whole system can thus use a centralised iBATIS configuration without
worrying about the visibility of SQLMaps that they don't really need.
 
 
Alistair.

________________________________

From: Alex Chew [mailto:chew.alex@gmail.com] 
Sent: 13 March 2009 02:24
To: user-java@ibatis.apache.org
Subject: Can I build a SqlMapClient from multiple xml files?


Hi all,
 
Many of our projects were built in a component-based way. Each component
got it's own SqlMapConfig and DaoConfig files. We must handly merge many
of those files into a single one to build a whole application with many
components. Is there a way to build a SqlMapClient or DaoManager from
multiple xml files?
 
For example,now we use following codes to build a SqlMapClient,the same
to the demo,
Reader reader =
Resources.getResourceAsReader("com/mydomain/data/SqlMapConfig.xml");
sqlMapper = SqlMapClientBuilder.buildSqlMapClient(reader);
 
Does there have a way like below pesudo codes?
Reader reader1 =
Resources.getResourceAsReader("com/mydomain/comp1/SqlMapConfig.xml");
Reader reader2 =
Resources.getResourceAsReader("com/mydomain/comp2/SqlMapConfig.xml");
SqlMapClientBuilder.buildSqlMapClient(reader1);
SqlMapClientBuilder.buildSqlMapClient(reader2);
sqlMapper = SqlMapClientBuilder.getSqlMapClient();
 
Thanks in advace.
Alex


Please help Logica to respect the environment by not printing this email  /  Merci d'aider
Logica à préserver l'environnement en évitant d'imprimer ce mail /  Bitte drucken Sie diese
Nachricht nicht aus und helfen Sie so Logica dabei die Umwelt zu schuetzen  /  Por favor ajude
a Logica a respeitar o ambiente não imprimindo este correio electrónico.



This e-mail and any attachment is for authorised use by the intended recipient(s) only. It
may contain proprietary material, confidential information and/or be subject to legal privilege.
It should not be copied, disclosed to, retained or used by, any other party. If you are not
an intended recipient then please promptly delete this e-mail and any attachment and all copies
and inform the sender. Thank you.


Mime
View raw message