iBatisNet 1.3 版本配置和1.2.1不同么?

0 views
Skip to first unread message

Viva

unread,
Jun 26, 2006, 3:40:04 AM6/26/06
to Ibatisnet用户组
我最近在测试1.3 版本的iBatisNet。新建了一个VS
2005的Windows
Form工程。同样的一个功能用1.2.1的iBatisNet下没有问题,但是换1.3之后就永远提示OR
Mapping的 xml文件出错。

比如我现在数据库表名叫 T_Link,然后对应的值对象是
T_Link.cs

同时我在SqlMap.config里挂接

<sqlMaps>
<sqlMap resource="XML/T_Link.xml"/>
</sqlMaps>

所有的config文件和XML目录都在项目的输出文件夹(ProjectName\bin\Debug\xxxxx)下。用1.2.1就没有问题。但是用1.3就提示如下错误信息。

************** Exception Text **************
IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while loading SqlMap.
- The error occurred in <sqlMap resource="XML/T_Link.xml"
xmlns="http://ibatis.apache.org/dataMapper" />. --->
System.NullReferenceException: Object reference not set to an instance
of an object.
at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureSqlMap()
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize()
at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean
isCallFromDao)
--- End of inner exception stack trace ---
at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean
isCallFromDao)
at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(String
resource, ConfigureHandler configureDelegate)
at IBatisNet.DataMapper.Mapper.InitMapper()
at IBatisNet.DataMapper.Mapper.Instance()
at iBatis13.Form1.button1_Click(Object sender, EventArgs e) in F:\My
Document\Visual Studio 2005\Projects\iBatis13\iBatis13\Form1.cs:line 24
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)


iBatisNet
被Apache升格为一级项目后我只在SqlMap.config的开头看到了一些变化:
<?xml version="1.0" encoding="utf-8"?>
<sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >

为什么同样的代码换包就不行了呢?在网上搜索了半天也没有找到关于1.3配置的不同,求高手指点。

hjf...@gmail.com

unread,
Jun 26, 2006, 10:07:31 AM6/26/06
to Ibatisnet用户组
你是不是有用selectKey?如果有的话,你在那个节点上加个属性type="post"

Viva

unread,
Jun 27, 2006, 9:11:36 PM6/27/06
to Ibatisnet用户组

hjf...@gmail.com wrote:
> 你是不是有用selectKey?如果有的话,你在那个节点上加个属性type="post"

没用到这个呢。我测试的时候用的是最最简单的配置。而且很诡异的是,我在同一个工程里。用1.2.1的iBatisNet包就没问题。然后当场修改该工程引用的iBatisNet包为1.3.1就提示如上错误。代码、配置什么的都不改。

对了。可有配置成功的1.3的iBatisNet读写数据库的小例子呢?我对比参考一下就好。

呃。我的邮箱就是这个gmail啦。多谢多谢。

zhangs...@gmail.com

unread,
Jun 27, 2006, 11:35:54 PM6/27/06
to Ibatisnet用户组
你可以到我的blog
http://www.cnblogs.com/shanyou/articles/376094.html
这篇文章的例子就是使用VS2005和1.3版本的

Viva

unread,
Jun 28, 2006, 4:46:33 AM6/28/06
to Ibatisnet用户组
嗯嗯,我看看。

Viva

unread,
Jun 28, 2006, 10:41:27 PM6/28/06
to Ibatisnet用户组
打开工程说
The project file
'xxxxxxxxxxxxxxxxxx\iBatisNet\IBatisNetDemo\Web\Web.csproj' cannot be
opened.
The project type is not supported by this installation.

然后发现项目里的两个工程其中Web这一个显示为unavailable...

我的VS 2005版本号为 Version 8.0.50727.42 (RTM.050727-4200)
Framework版本号为 Version 2.0.50727

用的公司订购的正版MSDN装的。

zhangs...@gmail.com

unread,
Jun 29, 2006, 1:13:47 AM6/29/06
to Ibatisnet用户组
需要安装Visual Studio 2005 Web Application Project
相关教程访问:http://webproject.scottgu.com/Default.aspx

下载地址:http://download.microsoft.com/download/9/0/6/906064ce-0bd1-4328-af40-49dca1aef87c/WebApplicationProjectSetup.msi

注意:安装之前,请先打上 Microsoft Visual Studio 2005 –
Update to Support Web Application Projects 补丁。下载地址:
http://download.microsoft.com/download/8/0/8/8086c312-16b1-4e54-a4cc-80a6c171112e/VS80-KB915364-X86-ENU.exe

[Last Modified By Admin, at 2006-05-10 16:02:33]

Reply all
Reply to author
Forward
0 new messages