ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent Apesa <vap...@hotmail.com>
Subject RE: file paths for config files in n-tier architecture
Date Fri, 16 Jan 2009 13:20:32 GMT

Correct me if I'm wrong, isn't the code example from the V1 src and not V3?
 
thanks,
Vince



Date: Wed, 14 Jan 2009 20:06:13 -0500From: christopher.deguise@be-pragmatic.comTo: user-cs@ibatis.apache.orgSubject:
Re: file paths for config files in n-tier architectureThe way I handled this was to use the
code from Example 4.4 and drive all IBatis request through the custom mapper. In addition
I altered the InitMapper method to look something like this:DomSqlMapBuilder builder = new
DomSqlMapBuilder();XmlDocument sqlMapConfig = Resources.GetEmbeddedResourceAsXmlDocument("fully.qualified.embedded.resource.SqlMap.config,
SomeAssembly");_Mapper = builder.Configure(sqlMapConfig);       Make sure you mark your config
files as embedded resources. With my projects I do not ship any raw .xml/.config files, they
are all bundled inside a library.Hope that helps.Chirs
On Wed, Jan 14, 2009 at 11:06 AM, Robin Silver <robin@sharedevent.com> wrote:



Hey all,
 
I have 4 facets to my application, Web, Test, Services, Data.  
 
Web – the website
Test – the token test project… ;)
Services – interface between web and underlying persistence layer (and additional services)
Data – my data model, POCO's etc.
 
Assume the scenario where there is a "List All Customer's" button on my page.  
 
Admin User clicks it and web calls CustomerService.ListAllCustomers().  This in turn calls
the iBatis structure sort of like…
 
ArrayList al = (ArrayList)Mapper.Instance().QueryForList("SelectAll", null);
            
The SqlMap.config and CustomerMapping.xml files are in my Services project.  
 
When I run this, I get the error: 
 
Unable to load file via resource "SqlMap.config" as resource. Cause : Could not find file
'C:\Projects\TestProject\TestProject.Web\SqlMap.config'.
 
It seems to want to load the config from the calling project (web), not the project in which
the actual code resides(services).  When I look at the NPetStore example, the config files
are in the web also. 
 
My question is, is there any way to configure it to look for files in the services project
instead?  I don't want to have any reference to IBatis in my Web if at all possible.
 
Thx,
Rob
_________________________________________________________________
Windows Live™: Keep your life in sync. 
http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t1_allup_howitworks_012009
Mime
View raw message