|
List Info
Thread: Mapping to a property named 'value'
|
|
| Mapping to a property named 'value' |
  Finland |
2008-03-05 01:48:51 |
|
I’m getting the
following exception for seemingly mysterious causes:
----------------------------
TestCase
'Domain.IbatisTest.TestGetCars'
failed:
System.NullReferenceException : Object reference not set to an instance of an
object.
at IBatisNet.DataMapper.DataExchange.DotNetObjectDataExchange.SetData(Object&
target, ResultProperty mapping, Object dataBaseValue)
at
IBatisNet.DataMapper.Configuration.ResultMapping.ResultMap.SetValueOfProperty(Object&
target, ResultProperty property, Object dataBaseValue)
at
IBatisNet.DataMapper.MappedStatements.PropertyStrategy.DefaultStrategy.Set(RequestScope
request, IResultMap resultMap, ResultProperty mapping, Object& target,
IDataReader reader, Object keys)
at
IBatisNet.DataMapper.MappedStatements.ResultStrategy.ResultMapStrategy.Process(RequestScope
request, IDataReader& reader, Object resultObject)
at
IBatisNet.DataMapper.MappedStatements.ResultStrategy.MapStrategy.Process(RequestScope
request, IDataReader& reader, Object resultObject)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForList[T](RequestScope
request, ISqlMapSession session, Object parameterObject, IList`1 resultObject,
RowDelegate`1 rowDelegate)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForList[T](ISqlMapSession
session, Object parameterObject)
at
IBatisNet.DataMapper.SqlMapper.QueryForList[T](String statementName, Object
parameterObject)
C:workDomainCarsHelper.cs(15,0):
at Domain.CarsHelper.GetCars(Int32 manufacturerId)
C:workDomainIbatisTest.cs(40,0):
at Domain.IbatisTest.TestGetCars()
----------------------------
The .Net class which I’m mapping to has a
property named ‘value’ which seems to be causing this.
If I remove the mapping to the ‘value’
property everything runs fine, or if I rename the property to e.g.
R16;value28217; and update the mapping it works fine.
Bug? Or is using ‘value’ as a property
name a big no-no?
|
| RE: Mapping to a property named 'value' |
  United States |
2008-03-05 06:07:59 |
|
I have no clue, but I could see value being a reserved property
name.
From: Carl-Petter Bertell
[mailto:Carl-Petter.Bertell tietoteollisuus.com]
Sent: Wednesday, March 05, 2008 2:49 AM
To: user-cs ibatis.apache.org
Subject: Mapping to a property named 'value'
I’m getting the
following exception for seemingly mysterious causes:
----------------------------
TestCase
'Domain.IbatisTest.TestGetCars'
failed:
System.NullReferenceException : Object reference not set to an instance of an
object.
at IBatisNet.DataMapper.DataExchange.DotNetObjectDataExchange.SetData(Object&
target, ResultProperty mapping, Object dataBaseValue)
at
IBatisNet.DataMapper.Configuration.ResultMapping.ResultMap.SetValueOfProperty(Object&
target, ResultProperty property, Object dataBaseValue)
at
IBatisNet.DataMapper.MappedStatements.PropertyStrategy.DefaultStrategy.Set(RequestScope
request, IResultMap resultMap, ResultProperty mapping, Object& target,
IDataReader reader, Object keys)
at IBatisNet.DataMapper.MappedStatements.ResultStrategy.ResultMapStrategy.Process(RequestScope
request, IDataReader& reader, Object resultObject)
at
IBatisNet.DataMapper.MappedStatements.ResultStrategy.MapStrategy.Process(RequestScope
request, IDataReader& reader, Object resultObject)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForList[T](RequestScope
request, ISqlMapSession session, Object parameterObject, IList`1 resultObject,
RowDelegate`1 rowDelegate)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForList[T](ISqlMapSession
session, Object parameterObject)
at IBatisNet.DataMapper.SqlMapper.QueryForList[T](String statementName, Object
parameterObject)
C:workDomainCarsHelper.cs(15,0): at Domain.CarsHelper.GetCars(Int32
manufacturerId)
C:workDomainIbatisTest.cs(40,0): at Domain.IbatisTest.TestGetCars()
----------------------------
The
.Net class which I’m mapping to has a property named ‘value’
which seems to be causing this.
If
I remove the mapping to the ‘value’ property everything runs fine,
or if I rename the property to e.g. ‘value2’ and update the mapping
it works fine.
Bug?
Or is using ‘value’ as a property name a big no-no?
Princeton Retirement Group, Inc - Important Terms
This E-mail is not intended for distribution to, or use by, any person or entity in any location where such distribution or use would be contrary to law or regulation, or which would subject Princeton Retirement Group, Inc. or any affiliate to any registration requirement within such location.
This E-mail may contain privileged or confidential information or may otherwise be protected by work product immunity or other legal rules. No confidentiality or privilege is waived or lost by any mistransmission. Access, copying or re-use of information by non-intended or non-authorized recipients is prohibited. If you are not an intended recipient of this E-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute any portion of this E-mail.
The transmission and content of this E-mail cannot be guaranteed to be secure or error-free. Therefore, we cannot represent that the information in this E-mail is complete, accurate, uncorrupted, timely or free of viruses, and Princeton Retirement Group, Inc. cannot accept any liability for E-mails that have been altered in the course of delivery. Princeton Retirement Group, Inc. reserves the right to monitor, review and retain all electronic communications, including E-mail, traveling through its networks and systems (subject to and in accordance with local laws). If any of your details are incorrect or if you no longer wish to receive mailings such as this by E-mail please contact the sender by reply E-mail.
|
| Re: Mapping to a property named 'value' |

|
2008-03-05 12:38:10 |
|
You might need to use a parameter map or result map to override the default behavior of the "value" special property. "value" is used when the entire object passed in is the parameter, not its properties. So therefore if your parameterClass="int", inside your query you would use #value# to emit the value of that int.
On 3/5/08, Clough, Samuel (USPC.PRG.Atlanta) < Samuel_Clough princetonrg.com">Samuel_Clough princetonrg.com> wrote:
I have no clue, but I could see value being a reserved property
name.
I'm getting the
following exception for seemingly mysterious causes:
----------------------------
TestCase
'Domain.IbatisTest.TestGetCars'
failed:
System.NullReferenceException : Object reference not set to an instance of an
object.
at IBatisNet.DataMapper.DataExchange.DotNetObjectDataExchange.SetData(Object&
target, ResultProperty mapping, Object dataBaseValue)
at
IBatisNet.DataMapper.Configuration.ResultMapping.ResultMap.SetValueOfProperty(Object&
target, ResultProperty property, Object dataBaseValue)
at
IBatisNet.DataMapper.MappedStatements.PropertyStrategy.DefaultStrategy.Set(RequestScope
request, IResultMap resultMap, ResultProperty mapping, Object& target,
IDataReader reader, Object keys)
at IBatisNet.DataMapper.MappedStatements.ResultStrategy.ResultMapStrategy.Process(RequestScope
request, IDataReader& reader, Object resultObject)
at
IBatisNet.DataMapper.MappedStatements.ResultStrategy.MapStrategy.Process(RequestScope
request, IDataReader& reader, Object resultObject)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForList[T](RequestScope
request, ISqlMapSession session, Object parameterObject, IList`1 resultObject,
RowDelegate`1 rowDelegate)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForList[T](ISqlMapSession
session, Object parameterObject)
at IBatisNet.DataMapper.SqlMapper.QueryForList[T](String statementName, Object
parameterObject)
C:workDomainCarsHelper.cs(15,0): at Domain.CarsHelper.GetCars(Int32
manufacturerId)
C:workDomainIbatisTest.cs(40,0): at Domain.IbatisTest.TestGetCars()
----------------------------
The
.Net class which I'm mapping to has a property named 'value'
which seems to be causing this.
If
I remove the mapping to the 'value' property everything runs fine,
or if I rename the property to e.g. 'value2' and update the mapping
it works fine.
Bug?
Or is using 'value' as a property name a big no-no?
Princeton Retirement Group, Inc - Important Terms
This E-mail is not intended for distribution to, or use by, any person or entity in any location where such distribution or use would be contrary to law or regulation, or which would subject Princeton Retirement Group, Inc. or any affiliate to any registration requirement within such location.
This E-mail may contain privileged or confidential information or may otherwise be protected by work product immunity or other legal rules. No confidentiality or privilege is waived or lost by any mistransmission. Access, copying or re-use of information by non-intended or non-authorized recipients is prohibited. If you are not an intended recipient of this E-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute any portion of this E-mail.
The transmission and content of this E-mail cannot be guaranteed to be secure or error-free. Therefore, we cannot represent that the information in this E-mail is complete, accurate, uncorrupted, timely or free of viruses, and Princeton Retirement Group, Inc. cannot accept any liability for E-mails that have been altered in the course of delivery. Princeton Retirement Group, Inc. reserves the right to monitor, review and retain all electronic communications, including E-mail, traveling through its networks and systems (subject to and in accordance with local laws). If any of your details are incorrect or if you no longer wish to receive mailings such as this by E-mail please contact the sender by reply E-mail.
|
[1-3]
|
|