You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Shawn Smiley <ss...@yahoo.com> on 2006/03/13 23:33:19 UTC
null value replacement for insert/update
Can someone point out to me what I'm doing wrong in the following statement:
<insert id="CreateNewPaymentLog" parameterClass="PaymentLog" resultMap="PaymentLogMap">
INSERT INTO PaymentLogs(AddsConfirmationNumber, AddsError, Amount, EntryDateTime, FullAccountNumber, ShortAccountNumber,
PaymentAuthCode, PaymentAuthResponse, PaymentAvsCode, PaymentCvv2Code, PaymentError, PaymentOrderId,
PaymentReferenceNumber, PaymentStatusCode, PaymentStatusDescription, TransactionId)
VALUES (#AddsConfirmationNumber:int:-1#, #AddsError#, #Amount#, #EntryDateTime:DateTime:0001-01-01T00:00:00#, #FullAccountNumber#, #ShortAccountNumber#,
#PaymentAuthCode#, #PaymentAuthResponse#, #PaymentAvsCode#, #PaymentCvv2Code#, #PaymentError#, #PaymentOrderId#,
#PaymentReferenceNumber#, #PaymentStatusCode#, #PaymentStatusDescription#, #TransactionId:Guid:00000000-0000-0000-0000-000000000000#)
<selectKey resultClass="int" type="post" property="Id">SELECT LAST_INSERT_ID()</selectKey>
</insert>
I'm trying to specify null replacement values on the properties, but when I include the inline null replacement parameters I get the following error at the IBatisNet.DataMapper.Mapper.Instance() call in my class.:
An unhandled exception of type 'IBatisNet.Common.Exceptions.ConfigurationException' occurred in ibatisnet.datamapper.dll
Additional information:
- The error occurred while loading SqlMap.
- Check the parameter mapping typeHandler attribute '' (must be a ITypeHandlerCallback implementation).
- The error occurred in <sqlMap resource="${root}DataMaps/PaymentLog.xml" xmlns="http://ibatis.apache.org/dataMapper" />.
- Check the CreateNewPaymentLog.
I've been fighting this for several hours now and really could use another set of eyes to look at it and point out my error. :-)
Thanks,
Shawn.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: null value replacement for insert/update
Posted by Shawn Smiley <ss...@yahoo.com>.
I found the problem. A mix of case-sensitivity and slight typos was causing the problem. The correct format for the null replacement was:
#AddsConfirmationNumber,type=int,dbType=Int32,nullValue=-1#
The dbType parameter has to have a capital T and the type it references has to be a System.Type object (i.e. Int32 not just int or a db provider type such as MySqlInt32).
Thanks,
Shawn.
Shawn Smiley <ss...@yahoo.com> wrote: I get the same error using the other notation. Here is the logging dump including the exception (from an nUnit test):
2006-03-14 08:28:20,585 [TestRunnerThread] INFO IBatisNet.DataMapper.Configuration.DomSqlMapBuilder [(null)] - Add property "provider" value "MySql"
2006-03-14 08:28:20,585 [TestRunnerThread] INFO IBatisNet.DataMapper.Configuration.DomSqlMapBuilder [(null)] - Add property "connectionString" value "Persist Security Info=False;Host=localhost;Protocol=tcp;Initial Catalog=AddsAudit;User Id=AddsAudit;password=password;"
2006-03-14 08:28:20,595 [TestRunnerThread] INFO IBatisNet.DataMapper.Configuration.DomSqlMapBuilder [(null)] - Add property "root" value ""
System.TypeInitializationException: The type initializer for "Data.Dal.PaymentLog" threw an exception. ---> IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while loading SqlMap.
- parse dynamic tags on sql statement
- The error occurre d in <sqlMap resource="${root}DataMaps/PaymentLog.xml" xmlns="http://ibatis.apache.org/dataMapper" />.
- Check the CreateNewPaymentLog. ---> IBatisNet.DataMapper.Exceptions.DataMapperException: Unrecognized parameter mapping field: 'dbtype' in AddsConfirmationNumber,type=int,dbtype=int,nullValue=-1
at IBatisNet.DataMapper.Configuration.ParameterMapping.InlineParameterMapParser.NewParseMapping(String token, Type parameterClassType, TypeHandlerFactory typeHandlerFactory)
at IBatisNet.DataMapper.Configuration.ParameterMapping.InlineParameterMapParser.ParseInlineParameterMap(TypeHandlerFactory typeHandlerFactory, IStatement statement, String sqlStatement)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ParseDynamicTags(XmlNode commandTextNode, IDynamicParent dynamic, StringBuilder sqlBuffer, Boolean isDynamic, Boolean postParseRequired)
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)
--- 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.Build(XmlDocument document, Boolean useConfigFileWatcher)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(String resource, ConfigureHandler configureDelegate)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(ConfigureHandler configureDelegate)
at IBatisNet.DataMapper.Mapper.InitMapper()
at IBatisNet.DataMapper.Mapper.Instance()
at Data.Dal.PaymentLog..cctor() in c:\vsprojects\addsintegration\trunk\addsintegrationsolution\data\dal\paymentlog.cs:line 23
--- End of inner exception stack trace ---
at Data.Dal.PaymentLog..ctor()
at UnitTests.DataTests.CreateLogEntry() in c:\vsprojects\addsintegration\trunk\addsintegrationsolution\unittests\datatests.cs:line 84
Thanks for your help,
Shawn
Ron Grabowski <ro...@yahoo.com> wrote: Could you post the full exception please? From looking at
InlineParameterMapParser.cs, it looks like the colon synta x is the
old-style of parsing. What happens when you use this notation:
#AddsConfirmationNumber,type=int,dbtype=int,nullValue=-1#
Is this the exception message you're getting?
"Error occurred during custom type handler configuration. Cause: "
I think the problem is that OldParseMapping looks for a certain number
of colons between the pound signs (3 or a number greater than or equal
to 5) and sends all other strings (without processing them) to an else
block. I bet the EntryDateTime parameter is causing the problem.
Once we figure out what's causing the exception I think the error
message should be improved to include the parameter name or the
complete contents between the pounds sign that its trying to parse.
--- Shawn Smiley wrote:
> Can someone point out to me what I'm doing wrong in the following
> statement:
>
>
> resultMap="PaymentLogMap">
> INSERT INTO PaymentLogs(AddsConfirmationNumber,
> AddsError, Amount, EntryDateTime, FullAccountNumber,
> ShortAccountNumber,
> PaymentAuthCode, PaymentAuthResponse, PaymentAvsCode,
> PaymentCvv2Code, PaymentError, PaymentOrderId,
> PaymentReferenceNumber, PaymentStatusCode,
> PaymentStatusDescription, TransactionId)
> VALUES (#AddsConfirmationNumber:int:-1#, #AddsError#,
> #Amount#, #EntryDateTime:DateTime:0001-01-01T00:00:00#,
> #FullAccountNumber#, #ShortAccountNumber#,
> #PaymentAuthCode#, #PaymentAuthResponse#,
> #PaymentAvsCode#, #PaymentCvv2Code#, #PaymentError#,
> #PaymentOrderId#,
> #PaymentReferenceNumber#, #PaymentStatusCode#,
> #PaymentStatusDescription#,
> #TransactionId:Guid:00000000-0000-0000-0000-0000000000 00#)
>
> property="Id">SELECT LAST_INSERT_ID()
>
>
> I'm trying to specify null replacement values on the properties, but
> when I include the inline null replacement parameters I get the
> following error at the IBatisNet.DataMapper.Mapper.Instance() call in
> my class.:
>
> An unhandled exception of type
> 'IBatisNet.Common.Exceptions.ConfigurationException' occurred in
> ibatisnet.datamapper.dll
>
> Additional information:
> - The error occurred while loading SqlMap.
> - Check the parameter mapping typeHandler attribute '' (must be a
> ITypeHandlerCallback implementation).
> - The error occurred in
> resource="${root}DataMaps/PaymentLog.xml"
> xmlns="http://ibatis.apache.org/dataMapper" />.
> - Check the CreateNewPaymentLog.
>
>
> ; I've been fighting this for several hours now and really could use
> another set of eyes to look at it and point out my error. :-)
>
> Thanks,
> Shawn.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
---------------------------------
Yahoo! Mail
Use Photomail to share photos without annoying attachments.
---------------------------------
Yahoo! Mail
Use Photomail to share photos without annoying attachments.
Re: null value replacement for insert/update
Posted by Shawn Smiley <ss...@yahoo.com>.
I get the same error using the other notation. Here is the logging dump including the exception (from an nUnit test):
2006-03-14 08:28:20,585 [TestRunnerThread] INFO IBatisNet.DataMapper.Configuration.DomSqlMapBuilder [(null)] - Add property "provider" value "MySql"
2006-03-14 08:28:20,585 [TestRunnerThread] INFO IBatisNet.DataMapper.Configuration.DomSqlMapBuilder [(null)] - Add property "connectionString" value "Persist Security Info=False;Host=localhost;Protocol=tcp;Initial Catalog=AddsAudit;User Id=AddsAudit;password=password;"
2006-03-14 08:28:20,595 [TestRunnerThread] INFO IBatisNet.DataMapper.Configuration.DomSqlMapBuilder [(null)] - Add property "root" value ""
System.TypeInitializationException: The type initializer for "Data.Dal.PaymentLog" threw an exception. ---> IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while loading SqlMap.
- parse dynamic tags on sql statement
- The error occurred in <sqlMap resource="${root}DataMaps/PaymentLog.xml" xmlns="http://ibatis.apache.org/dataMapper" />.
- Check the CreateNewPaymentLog. ---> IBatisNet.DataMapper.Exceptions.DataMapperException: Unrecognized parameter mapping field: 'dbtype' in AddsConfirmationNumber,type=int,dbtype=int,nullValue=-1
at IBatisNet.DataMapper.Configuration.ParameterMapping.InlineParameterMapParser.NewParseMapping(String token, Type parameterClassType, TypeHandlerFactory typeHandlerFactory)
at IBatisNet.DataMapper.Configuration.ParameterMapping.InlineParameterMapParser.ParseInlineParameterMap(TypeHandlerFactory typeHandlerFactory, IStatement statement, String sqlStatement)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ParseDynamicTags(XmlNode commandTextNode, IDynamicParent dynamic, StringBuilder sqlBuffer, Boolean isDynamic, Boolean postParseRequired)
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)
--- 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.Build(XmlDocument document, Boolean useConfigFileWatcher)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(String resource, ConfigureHandler configureDelegate)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(ConfigureHandler configureDelegate)
at IBatisNet.DataMapper.Mapper.InitMapper()
at IBatisNet.DataMapper.Mapper.Instance()
at Data.Dal.PaymentLog..cctor() in c:\vsprojects\addsintegration\trunk\addsintegrationsolution\data\dal\paymentlog.cs:line 23
--- End of inner exception stack trace ---
at Data.Dal.PaymentLog..ctor()
at UnitTests.DataTests.CreateLogEntry() in c:\vsprojects\addsintegration\trunk\addsintegrationsolution\unittests\datatests.cs:line 84
Thanks for your help,
Shawn
Ron Grabowski <ro...@yahoo.com> wrote: Could you post the full exception please? From looking at
InlineParameterMapParser.cs, it looks like the colon syntax is the
old-style of parsing. What happens when you use this notation:
#AddsConfirmationNumber,type=int,dbtype=int,nullValue=-1#
Is this the exception message you're getting?
"Error occurred during custom type handler configuration. Cause: "
I think the problem is that OldParseMapping looks for a certain number
of colons between the pound signs (3 or a number greater than or equal
to 5) and sends all other strings (without processing them) to an else
block. I bet the EntryDateTime parameter is causing the problem.
Once we figure out what's causing the exception I think the error
message should be improved to include the parameter name or the
complete contents between the pounds sign that its trying to parse.
--- Shawn Smiley wrote:
> Can someone point out to me what I'm doing wrong in the following
> statement:
>
>
> resultMap="PaymentLogMap">
> INSERT INTO PaymentLogs(AddsConfirmationNumber,
> AddsError, Amount, EntryDateTime, FullAccountNumber,
> ShortAccountNumber,
> PaymentAuthCode, PaymentAuthResponse, PaymentAvsCode,
> PaymentCvv2Code, PaymentError, PaymentOrderId,
> PaymentReferenceNumber, PaymentStatusCode,
> PaymentStatusDescription, TransactionId)
> VALUES (#AddsConfirmationNumber:int:-1#, #AddsError#,
> #Amount#, #EntryDateTime:DateTime:0001-01-01T00:00:00#,
> #FullAccountNumber#, #ShortAccountNumber#,
> #PaymentAuthCode#, #PaymentAuthResponse#,
> #PaymentAvsCode#, #PaymentCvv2Code#, #PaymentError#,
> #PaymentOrderId#,
> #PaymentReferenceNumber#, #PaymentStatusCode#,
> #PaymentStatusDescription#,
> #TransactionId:Guid:00000000-0000-0000-0000-000000000000#)
>
> property="Id">SELECT LAST_INSERT_ID()
>
>
> I'm trying to specify null replacement values on the properties, but
> when I include the inline null replacement parameters I get the
> following error at the IBatisNet.DataMapper.Mapper.Instance() call in
> my class.:
>
> An unhandled exception of type
> 'IBatisNet.Common.Exceptions.ConfigurationException' occurred in
> ibatisnet.datamapper.dll
>
> Additional information:
> - The error occurred while loading SqlMap.
> - Check the parameter mapping typeHandler attribute '' (must be a
> ITypeHandlerCallback implementation).
> - The error occurred in
> resource="${root}DataMaps/PaymentLog.xml"
> xmlns="http://ibatis.apache.org/dataMapper" />.
> - Check the CreateNewPaymentLog.
>
>
> I've been fighting this for several hours now and really could use
> another set of eyes to look at it and point out my error. :-)
>
> Thanks,
> Shawn.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
---------------------------------
Yahoo! Mail
Use Photomail to share photos without annoying attachments.
Re: null value replacement for insert/update
Posted by Ron Grabowski <ro...@yahoo.com>.
Could you post the full exception please? From looking at
InlineParameterMapParser.cs, it looks like the colon syntax is the
old-style of parsing. What happens when you use this notation:
#AddsConfirmationNumber,type=int,dbtype=int,nullValue=-1#
Is this the exception message you're getting?
"Error occurred during custom type handler configuration. Cause: "
I think the problem is that OldParseMapping looks for a certain number
of colons between the pound signs (3 or a number greater than or equal
to 5) and sends all other strings (without processing them) to an else
block. I bet the EntryDateTime parameter is causing the problem.
Once we figure out what's causing the exception I think the error
message should be improved to include the parameter name or the
complete contents between the pounds sign that its trying to parse.
--- Shawn Smiley <ss...@yahoo.com> wrote:
> Can someone point out to me what I'm doing wrong in the following
> statement:
>
> <insert id="CreateNewPaymentLog" parameterClass="PaymentLog"
> resultMap="PaymentLogMap">
> INSERT INTO PaymentLogs(AddsConfirmationNumber,
> AddsError, Amount, EntryDateTime, FullAccountNumber,
> ShortAccountNumber,
> PaymentAuthCode, PaymentAuthResponse, PaymentAvsCode,
> PaymentCvv2Code, PaymentError, PaymentOrderId,
> PaymentReferenceNumber, PaymentStatusCode,
> PaymentStatusDescription, TransactionId)
> VALUES (#AddsConfirmationNumber:int:-1#, #AddsError#,
> #Amount#, #EntryDateTime:DateTime:0001-01-01T00:00:00#,
> #FullAccountNumber#, #ShortAccountNumber#,
> #PaymentAuthCode#, #PaymentAuthResponse#,
> #PaymentAvsCode#, #PaymentCvv2Code#, #PaymentError#,
> #PaymentOrderId#,
> #PaymentReferenceNumber#, #PaymentStatusCode#,
> #PaymentStatusDescription#,
> #TransactionId:Guid:00000000-0000-0000-0000-000000000000#)
> <selectKey resultClass="int" type="post"
> property="Id">SELECT LAST_INSERT_ID()</selectKey>
> </insert>
>
> I'm trying to specify null replacement values on the properties, but
> when I include the inline null replacement parameters I get the
> following error at the IBatisNet.DataMapper.Mapper.Instance() call in
> my class.:
>
> An unhandled exception of type
> 'IBatisNet.Common.Exceptions.ConfigurationException' occurred in
> ibatisnet.datamapper.dll
>
> Additional information:
> - The error occurred while loading SqlMap.
> - Check the parameter mapping typeHandler attribute '' (must be a
> ITypeHandlerCallback implementation).
> - The error occurred in <sqlMap
> resource="${root}DataMaps/PaymentLog.xml"
> xmlns="http://ibatis.apache.org/dataMapper" />.
> - Check the CreateNewPaymentLog.
>
>
> I've been fighting this for several hours now and really could use
> another set of eyes to look at it and point out my error. :-)
>
> Thanks,
> Shawn.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com