Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 46884 invoked from network); 27 May 2008 15:12:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 May 2008 15:12:18 -0000 Received: (qmail 26998 invoked by uid 500); 27 May 2008 15:12:17 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 26986 invoked by uid 500); 27 May 2008 15:12:17 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 26975 invoked by uid 99); 27 May 2008 15:12:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 May 2008 08:12:17 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jeffgbutler@gmail.com designates 64.233.178.249 as permitted sender) Received: from [64.233.178.249] (HELO hs-out-0708.google.com) (64.233.178.249) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 May 2008 15:11:30 +0000 Received: by hs-out-0708.google.com with SMTP id x43so1297696hsb.0 for ; Tue, 27 May 2008 08:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=yEwmAl8nMUfex+pq9aMuL/sBzovh+18CeeQbigatqtk=; b=b22sIlRm8yhKoD8JdQJEpG5NYa1RHczUIJBjcBqBZ6ODt959uwUC1IbmLH6QbJasxgxo8fREm6r4GMqQzjfkQzKYWWx03JiBnpB6MXECZZM3pmTdoAemkh7HQ5LTSFHHQEcxQsS0/L5eXs0RF/RGwxzzFwVQBfUs4qLhXghLMlo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=qQur4fx7aOmgiaDyu7CXH6Ld2uUG/hTRN1gep7baRgkV5jNhobbcLwzPbqbLEqS5DM4fZaF/Oxg6gP1f9aZIAkE19UZGkH6sxsl0oU8J9eWRUHEgq4DfpwrsoSggGAmjKPADn67vsPGsK7m084Yh4kZSoVolRDnOLTbaZZW5RGs= Received: by 10.90.115.6 with SMTP id n6mr1839513agc.3.1211901105326; Tue, 27 May 2008 08:11:45 -0700 (PDT) Received: by 10.90.90.1 with HTTP; Tue, 27 May 2008 08:11:45 -0700 (PDT) Message-ID: Date: Tue, 27 May 2008 10:11:45 -0500 From: "Jeff Butler" To: user-java@ibatis.apache.org Subject: Re: Mapping HSQLDB's binary using iBatis In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_16234_31666254.1211901105348" References: X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_16234_31666254.1211901105348 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I have tests working fine with the HSQLDB binary type: 1. Use a byte[] for the property. 2. Set jdbcType to "BINARY" in your parameter and result mappings Jeff Butler On Tue, May 27, 2008 at 9:32 AM, Jonathan Alvarsson < jonathan.alvarsson@gmail.com> wrote: > Okey this was a really long time ago but attempt to circumvent this is not > working. I really need the BINARY data type in the database because I need > to perform bitwise and during a query (btw: would you do that in a stored > procedure?). I am using HSQLDB for the moment and I see that they use byte[] > for internal representation of a binary so I thought I would try that but > that was of course not the way to go. How do I insert to a binary column > using iBatis? It must be possible to do somehow right? > > > On Fri, Sep 28, 2007 at 5:35 PM, Yee, Richard K CTR DMDC < > Richard.Yee.ctr@osd.pentagon.mil> wrote: > >> What does the code look like that you are using to call the >> sqlMap.insert() with? It looks like you are passing in a string for the >> byte[] >> >> -Richard >> >> -----Original Message----- >> From: Jonathan Alvarsson [mailto:jonathan.alvarsson@gmail.com] >> Sent: Friday, September 28, 2007 4:56 AM >> To: user-java@ibatis.apache.org >> Subject: Mapping HSQLDB's binary using iBatis >> >> I am trying persist a serializable object to hsqldb's binary datatype. I >> am currently building a byte[] but obviously there is no iBatis standard >> type handler for this operation because I get the following errorwhen >> trying to persist: >> >> >> org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; >> bad SQL grammar []; nested exception is >> com.ibatis.common.jdbc.exception.NestedSQLException: >> --- The error occurred in sqlMap.xml. >> --- The error occurred while applying a parameter map. >> --- Check the Structure.insertWithoutLibrary-InlineParameterMap. >> --- Check the statement (update failed). >> --- Cause: java.sql.SQLException : Wrong data type: java.io.IOException: >> hexadecimal string contains non hex character in statement [ >> INSERT INTO Structure ( id, baseObject, smiles, >> fingerPrintString, molecule ) VALUES ( >> '07bdad55-1433-4b12-8446-aa7d0fe644f9', >> '07bdad55-1433-4b12-8446-aa7d0fe644f9', '', >> '0000000000000000000000000000000000000000000000000000000000000000', '[ >> B@1107304' ); ] >> Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: >> --- The error occurred in sqlMap.xml. >> --- The error occurred while applying a parameter map. >> --- Check the Structure.insertWithoutLibrary-InlineParameterMap . >> --- Check the statement (update failed). >> --- Cause: java.sql.SQLException: Wrong data type: java.io.IOException: >> hexadecimal string contains non hex character in statement [ >> INSERT INTO Structure ( id, baseObject, smiles, >> fingerPrintString, molecule ) VALUES ( >> '07bdad55-1433-4b12-8446-aa7d0fe644f9', >> '07bdad55-1433-4b12-8446-aa7d0fe644f9', '', >> '0000000000000000000000000000000000000000000000000000000000000000', '[ >> B@1107304' ); ] >> >> >> How can I make this work? >> >> -- >> // Jonathan >> > > > > -- > // Jonathan ------=_Part_16234_31666254.1211901105348 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
I have tests working fine with the HSQLDB binary type:
 
1. Use a byte[] for the property.
2. Set jdbcType to "BINARY" in your parameter and result mappings

Jeff Butler

 
On Tue, May 27, 2008 at 9:32 AM, Jonathan Alvarsson <jonathan.alvarsson@gmail.com> wrote:
Okey this was a really long time ago but attempt to circumvent this is not working. I really need the BINARY data type in the database because I need to perform bitwise and during a query (btw: would you do that in a stored procedure?). I am using HSQLDB for the moment and I see that they use byte[] for internal representation of a binary so I thought I would try that but that was of course not the way to go. How do I insert to a binary column using iBatis? It must be possible to do somehow right?


On Fri, Sep 28, 2007 at 5:35 PM, Yee, Richard K CTR DMDC <Richard.Yee.ctr@osd.pentagon.mil> wrote:
What does the code look like that you are using to call the
sqlMap.insert() with? It looks like you are passing in a string for the
byte[]

-Richard

-----Original Message-----
From: Jonathan Alvarsson [mailto:jonathan.alvarsson@gmail.com]
Sent: Friday, September 28, 2007 4:56 AM
To: user-java@ibatis.apache.org
Subject: Mapping HSQLDB's binary using iBatis

I am trying persist a serializable object to hsqldb's binary datatype. I
am currently building a byte[] but obviously there is no iBatis standard
type handler for this operation because I get the following errorwhen
trying to persist:


org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation;
bad SQL grammar []; nested exception is
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in sqlMap.xml.
--- The error occurred while applying a parameter map.
--- Check the Structure.insertWithoutLibrary-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException : Wrong data type: java.io.IOException:
hexadecimal string contains non hex character in statement [
INSERT INTO Structure (   id,     baseObject, smiles,
fingerPrintString,     molecule       )                        VALUES (
'07bdad55-1433-4b12-8446-aa7d0fe644f9',
'07bdad55-1433-4b12-8446-aa7d0fe644f9',     '',
'0000000000000000000000000000000000000000000000000000000000000000', '[
B@1107304' );     ]
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in sqlMap.xml.
--- The error occurred while applying a parameter map.
--- Check the Structure.insertWithoutLibrary-InlineParameterMap .
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: Wrong data type: java.io.IOException:
hexadecimal string contains non hex character in statement [
INSERT INTO Structure (   id,     baseObject, smiles,
fingerPrintString,     molecule       )                        VALUES (
'07bdad55-1433-4b12-8446-aa7d0fe644f9',
'07bdad55-1433-4b12-8446-aa7d0fe644f9',     '',
'0000000000000000000000000000000000000000000000000000000000000000', '[
B@1107304' );     ]


How can I make this work?

--
// Jonathan



--
// Jonathan

------=_Part_16234_31666254.1211901105348--