Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 40019 invoked from network); 29 Nov 2004 01:41:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 29 Nov 2004 01:41:52 -0000 Received: (qmail 83749 invoked by uid 500); 29 Nov 2004 01:41:46 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 83711 invoked by uid 500); 29 Nov 2004 01:41:46 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@geronimo.apache.org Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 83698 invoked by uid 99); 29 Nov 2004 01:41:46 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from Unknown (HELO mgd.gluecode.com) (64.14.202.141) by apache.org (qpsmtpd/0.28) with ESMTP; Sun, 28 Nov 2004 17:41:44 -0800 Received: from [10.0.1.5] (ca-stmnca-cuda2-blade8b-82.stmnca.adelphia.net [68.65.226.82]) (authenticated bits=0) by mgd.gluecode.com (8.12.10/8.12.10) with ESMTP id iAT1fZCW014555 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO) for ; Sun, 28 Nov 2004 17:41:36 -0800 Mime-Version: 1.0 (Apple Message framework v619) In-Reply-To: <41AA5C36.408@optusnet.com.au> References: <41AA5C36.408@optusnet.com.au> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Dain Sundstrom Subject: Re: BLOB manipulation - question Date: Sun, 28 Nov 2004 17:41:42 -0800 To: dev@geronimo.apache.org X-Mailer: Apple Mail (2.619) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On Nov 28, 2004, at 3:16 PM, Gianny Damour wrote: > Hi, > > I am working on the support of Dependent Value Classes. > > The implementation is rather simple: if a binding is not explicitely > defined for a CMP field class (see > org.tranql.sql.jdbc.binding.BindingFactory) and if the class > implements Serializable, then one assumes that the CMP field is a > Dependent Value Class. Such CMP fields are stored into BLOB columns. I suggest that if the object is not explicitly defined you assume it is serializable. The problem with checking for serializable is the field type typically doesn't implement serializable. For example, people often use java.lang.Object for a generic field type. > The serialized object is stored into the BLOB via the > PreparedStatement.setBinaryStream(int parameterIndex, > java.io.InputStream x, int length) method. As a matter of fact, this > works with Derby. Yet, it seems that this is not the "correct" way. > More accurately, it seems that PreparedStatement.setBlob (int i, Blob > x) is the "correct" way. > > Anyone knows if PreparedStatement.setBinaryStream is portable? It's been a while, but last time I checked setBinaryStream didn't work in oracle for streams bigger then 4k. IIRC, the right way to update a blob is to get a blob object from a result set using getBlob and change the new bytes into the blob (truncate it maybe?). At this point, I don't remember what you do... maybe call updateBlob, or set it into an update statement. Anyway, I remember the only portable way was to use the LOG objects directly. I also remember that inserting a new LOB was tricky. Maybe someone that has worked with oracle recently can fill all of us in on LOB support in the new oracle drivers. -dain