You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "cristian manea (JIRA)" <ib...@incubator.apache.org> on 2006/07/18 17:35:17 UTC

[jira] Created: (IBATISNET-168) The parameter class reflection does not work anymore

The parameter class reflection does not work anymore
----------------------------------------------------

                 Key: IBATISNET-168
                 URL: http://issues.apache.org/jira/browse/IBATISNET-168
             Project: iBatis for .NET
          Issue Type: Bug
          Components: DataMapper
    Affects Versions: DataMapper 1.5
         Environment: Windows 2003 server, dot net framework 2.0, VS2005
            Reporter: cristian manea
            Priority: Blocker


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{return _DataObject; }set { _DataObject = value;}}
		private Object _ParametersObject;
		public object     ParametersObject{get { return _ParametersObject; }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)
		{
			Labels objLabel =  (Label) Mapper ().QueryForObject("SelectLabel",obj);
			return(objLabel);
		}


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


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (IBATISNET-168) The parameter class reflection does not work anymore

Posted by "cristian manea (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATISNET-168?page=comments#action_12421899 ] 
            
cristian manea commented on IBATISNET-168:
------------------------------------------

Hello, I'm still Cristian Manea.

I was able to BYPASS the problem by eliminating the parameterClass property from ALL the select statements in my sqlMaps.

<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> 

I think the problem comes from that new "Probe" that is done when parsing the maps. As a humble opinion: at least until one is 100% sure, the "anomalies" found by the new probe object should not block everything by throwing an error...maybe they shoud be only treated as some kind of warning and nothing more. 

It is clear that not giving the probe a chance to work (since i'm not telling it what class I'm passing as a parameter), it works as in the previous version (which did not have the probe).

Best regards.

Cristian Manea
www.atypiqsoftware.ro

> The parameter class reflection does not work anymore
> ----------------------------------------------------
>
>                 Key: IBATISNET-168
>                 URL: http://issues.apache.org/jira/browse/IBATISNET-168
>             Project: iBatis for .NET
>          Issue Type: Bug
>          Components: DataMapper
>    Affects Versions: DataMapper 1.5
>         Environment: Windows 2003 server, dot net framework 2.0, VS2005
>            Reporter: cristian manea
>            Priority: Blocker
>
> 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{return _DataObject; }set { _DataObject = value;}}
> 		private Object _ParametersObject;
> 		public object     ParametersObject{get { return _ParametersObject; }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)
> 		{
> 			Labels objLabel =  (Label) Mapper ().QueryForObject("SelectLabel",obj);
> 			return(objLabel);
> 		}
> 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (IBATISNET-168) The parameter class reflection does not work anymore

Posted by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/IBATISNET-168?page=all ]

Gilles Bayon closed IBATISNET-168.
----------------------------------

    Fix Version/s: DataMapper 1.5.1
       Resolution: Fixed
         Assignee: Gilles Bayon

In SVN

> The parameter class reflection does not work anymore
> ----------------------------------------------------
>
>                 Key: IBATISNET-168
>                 URL: http://issues.apache.org/jira/browse/IBATISNET-168
>             Project: iBatis for .NET
>          Issue Type: Bug
>          Components: DataMapper
>    Affects Versions: DataMapper 1.5
>         Environment: Windows 2003 server, dot net framework 2.0, VS2005
>            Reporter: cristian manea
>         Assigned To: Gilles Bayon
>            Priority: Blocker
>             Fix For: DataMapper 1.5.1
>
>
> 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{return _DataObject; }set { _DataObject = value;}}
> 		private Object _ParametersObject;
> 		public object     ParametersObject{get { return _ParametersObject; }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)
> 		{
> 			Labels objLabel =  (Label) Mapper ().QueryForObject("SelectLabel",obj);
> 			return(objLabel);
> 		}
> 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira