I put this zip file up for someone in 2/2006:
http://www.ronosaurus.com/IBatisNet/HelloWorld.zip
Of course its not the current version anymore but the syntax for doings things
hasn't changed drastically in the last several months. The project is a simple
Console Application that connects to an Access database and runs one or two
SELECT statements. It uses Log4net for logging.
----- Original Message ----
From: robsosno <[EMAIL PROTECTED]>
To: user-cs@ibatis.apache.org
Sent: Tuesday, October 17, 2006 4:24:56 PM
Subject: Re: can't run iBatis Tutorial
robsosno wrote:
I'm trying to evaluate iBatis to check if it will be useful for me.
I've converted my existing application to use iBatis but I've got
several errors when trying it to run (compilation was successfull).
I know that it could be that this is due to my lack of knowledge so
I've tried tutorial application downloaded from:
http://prdownloads.sourceforge.net/ibatisnet/Tutorial-1.2.1.zip?download
Unfortunately I've got the same bugs related to SqlMapConfig.xsd as
from my application.
I'm using IBatisNet.DataMapper-bin-1.5.1, .NET 1.1, Visual Studio 2003.
Attachments contains all details. First I've got "Cannot load
schema..." error message. I've tried to copy all 3 xsd
(SqlMapConfig.xsd, SqlMap.xsd, provider.xsd) files into all possible
places within tutorial directory. Also I've tried to include xsd file
into the VS solution as a resource but error message haven't changed.
So in the end I've copied SqlMapConfig.xsd as message Could not find
file "c:\winnt\system32\SqlMapConfig.xsd" suggest it.
I've got new error message which is completely not understandable for me.
I'm beginner with iBatis so I'm not able to tackle with this issue
myself - please help with running this tutorial.
Regards,
RobertS
I've found a way to run Tutorial. However it was very painful for the
beginner.
First I've tried available samples and tutorials:
http://prdownloads.sourceforge.net/ibatisnet/NPetshop-1.0.0.RC1.zip?download
http://prdownloads.sourceforge.net/ibatisnet/Tutorial-1.2.1.zip?download
Nothing works. Then I've got what it seemed most simple for me:
http://opensource.atlassian.com/confluence/oss/display/IBATIS/Quick+Start+Guide
Of course it also doesn't work. However sample was so small then I've
tried to fix it issue by issue.
I've found following issues and solutions::
1.
D:\Programs\devel\IBatisNet.DataMapper-bin-1.5.1\QuickStart2\Mapper.cs(17):
Cannot implicitly convert type 'IBatisNet.DataMapper.ISqlMapper' to
'IBatisNet.DataMapper.SqlMapper'
After googling I've found that API have changed so it is necessary to
change from:
private static volatile SqlMapper _mapper = null;
to
private static volatile ISqlMapper _mapper = null;
Then all methods returning SqlMapper needs to return ISqlMapper instead
(methods Instance, Get).
In all other tutorials I see the same issue.
2. Couldn't find SqlMap.config
I've copied it to directory where are all executables (bin\Debug).
3. Couldn't find providers.config
I've copied it to directory where are all executables (bin\Debug).
4. Error while configuring the Provider named "OleDb1.1". Cause: The
provider is not in 'providers.config' or is not enabled.
<providers> tag in providers.config should be replaced by:
<providers
xmlns="http://ibatis.apache.org/providers";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
5. Could not find Person.xml
I've copied Person.xml to bin\Debug\Resources
6. Unable to load file via resource "Resource/Person.xml" as resource.
Cause: There are multiple root elements. Line 5 position 4.
Added missing root tag to person.xml (copied from tutorial, file
PersonHelper.xml):
<sqlMap
namespace="Person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="SqlMap.xsd">
7. Object reference not set to an instance of the object
After googling much I've found that somebody else had similar issue.
Solution is to replace:
xsi:noNamespaceSchemaLocation="SqlMapConfig.xsd"
with:
xmlns="http://ibatis.apache.org/dataMapper";
iin sqlmap.config .
7. System.TypeLoadException : Could not load type from string value
'iBatisTutorial.Model.Person, iBatisTutorial.Model'.
Changed to 'iBatisTutorial.Model.Person'.
8. This SQL map does not contain a MappedStatement named SelectAll.
I've added missing <resultMaps> tag to person.xml
9. There is no Set member named 'FirstName', in class 'Person'.
I've changed in class Person:
// Other public properties for the private fields ...
to the full class definition.
10. This SQL map does not contain a MappedStatement named SelectAll.
I've added missing <statements> tag to person.xml
11. SqlMapper.ConfigureAndWatch (handler) (warning): This method will be
remove in future version, use DomSqlMapBuilder.Configure
I leaved as is. I do not know how to emulate ConfigureAndWatch with
DomSqlMapBuilder.Configure yet.
It was really hardest "Quick start" tutorial I've encountered so far.
I've back to the tutorial from
http://prdownloads.sourceforge.net/ibatisnet/Tutorial-1.2.1.zip?download
With my new knowledge it was quite simple: solution no 7 was enough to
run it successfully.
Then I've returned back to my application I've started to work with.
Unfortunately I still have some problems. I have "Object reference not
set to an instance of the object" from Configure() method even after
using all solutions which I've found earlier. Even empty xml map (which
is obviously error free) doesn't help.
This time I'm sure that this is my own fault. Nevertheless more friendly
error message concerning what is wrong with the configuration would be
the best.
I'm wondering if iBatisNet is designed only for heavy crackers who are
not using any docs because they remember every byte of iBatis source.
Regards,
Robert Sosnowski