Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
DataMapper 1.5
-
None
-
Windows 2003 server, dot net framework 2.0, VS2005
Description
Hello.
We have upgraded our project from dnf 1.1 to dnf 2.0 vs2005, so we have upgraded to Data Mapper 1.5 (from 1.3).
It seams that the dynamic class reflection for the query parameters does not work anymore in 1.5, in the 1.3 version it work just fine. It is really a blocking situation for us, because...it simply does not work anymore
We are using a solution where the parameter that we are passing is a "generic" one, and has this definition:
public class Query
{
private Object _DataObject;
public Object DataObject{get
set { _DataObject = value;}}
private Object _ParametersObject;
public object ParametersObject{get
set { _ParametersObject = value; }}
}
Then we are passing to iBatis (by internal convention) the "parameters" embeded in the Query class, here is an example:
obj_Query.ParametersObject = Parameters; //here we are setting our Parameters object
obj_Query.DataObject = Labels[0]; //here we are setting our Business Object
objLabel = (Label) Helpers.Label().Read(obj_Query); //here we are calling by passing the query object
Assert.IsNotNull (objLabel, "Label not returned");
.............................................................................................
public override System.Object Read(System.Object obj)
The mapped statemend in the sqlmap file is as follows:
<select id="SelectLabel" parameterClass="Query" resultMap="LabelResult">
select *
from ll_label_language
<dynamic prepend="WHERE">
<isParameterPresent>
<isNotNull property="DataObject">
<isGreaterThan property="DataObject.Id" compareValue="0" prepend="AND">
label_language_id = #DataObject.Id#
</isGreaterThan>
<isGreaterThan property="DataObject.LabelId" compareValue="0" prepend="AND">
label_id = #DataObject.LabelId#
</isGreaterThan>
</isNotNull>
<isNotNull property="ParametersObject" prepend="AND">
language_id = #ParametersObject.LanguageId#
</isNotNull>
</isParameterPresent>
</dynamic>
</select>
iBatis 1.5 returns this error (it does not understand that the DataObject is in fact a Label, and not an Object):
failed: IBatisNet.Common.Exceptions.ConfigurationException :
- The error occurred while loading SqlMap.
- parse dynamic tags on sql statement
- The error occurred in <sqlMap resource="${root}Resources/LabelHelper.xml" xmlns="http://ibatis.apache.org/dataMapper" />.
- Check the SelectLabel.
----> IBatisNet.Common.Exceptions.ProbeException : There is no Get member named 'Id' in class 'Object'
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()
C:\Documents and Settings\Administrator\Favorites\LogiqLibrary\Source\LL\LL_BusinessObjects\Helper.cs(18,0): at LL_BusinessObjects.Helper.Mapper()
C:\Documents and Settings\Administrator\Favorites\LogiqLibrary\Source\LL\LL_BusinessObjects\LanguageHelper.cs(17,0): at LL_BusinessObjects.LanguageHelper.ReadList(Object obj)
C:\Documents and Settings\Administrator\Favorites\LogiqLibrary\Source\LL\LL_Tests\DAL_tests.cs(27,0): at LL_Tests.DAL_tests.LanguageSelects()
--ConfigurationException
at IBatisNet.Common.Utilities.Objects.ReflectionInfo.GetGetterType(String memberName)
at IBatisNet.Common.Utilities.Objects.ObjectProbe.GetMemberTypeForGetter(Type type, String memberName)
at IBatisNet.DataMapper.Configuration.ParameterMapping.InlineParameterMapParser.ResolveTypeHandler(TypeHandlerFactory typeHandlerFactory, Type parameterClassType, String propertyName, String propertyType, String dbType)
at IBatisNet.DataMapper.Configuration.ParameterMapping.InlineParameterMapParser.NewParseMapping(String token, Type parameterClassType, IScope scope)
at IBatisNet.DataMapper.Configuration.ParameterMapping.InlineParameterMapParser.ParseInlineParameterMap(IScope scope, IStatement statement, String sqlStatement)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ParseDynamicTags(XmlNode commandTextNode, IDynamicParent dynamic, StringBuilder sqlBuffer, Boolean isDynamic, Boolean postParseRequired, IStatement statement)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ParseDynamicTags(XmlNode commandTextNode, IDynamicParent dynamic, StringBuilder sqlBuffer, Boolean isDynamic, Boolean postParseRequired, IStatement statement)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ParseDynamicTags(XmlNode commandTextNode, IDynamicParent dynamic, StringBuilder sqlBuffer, Boolean isDynamic, Boolean postParseRequired, IStatement statement)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ParseDynamicTags(XmlNode commandTextNode, IDynamicParent dynamic, StringBuilder sqlBuffer, Boolean isDynamic, Boolean postParseRequired, IStatement statement)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ParseDynamicTags(XmlNode commandTextNode, IDynamicParent dynamic, StringBuilder sqlBuffer, Boolean isDynamic, Boolean postParseRequired, IStatement statement)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ProcessSqlStatement(IStatement statement)
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)
Thank you for your support.
Cristian Manea
www.atypiqsoftware.ro