Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W83lr-0003rN-FB for pgsql-jdbc@arkaria.postgresql.org; Tue, 28 Jan 2014 08:11:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W83lq-0001EI-Uz for pgsql-jdbc@arkaria.postgresql.org; Tue, 28 Jan 2014 08:11:47 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W83lq-0001EC-7U for pgsql-jdbc@postgresql.org; Tue, 28 Jan 2014 08:11:46 +0000 Received: from prod2.officenet.no ([195.159.87.246]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W83lm-0006YD-AY for pgsql-jdbc@postgresql.org; Tue, 28 Jan 2014 08:11:45 +0000 Received: from localhost ([127.0.0.1] helo=prod2) by prod2.officenet.no with esmtp (Exim 4.76) (envelope-from ) id 1W83ji-0007g5-9q for pgsql-jdbc@postgresql.org; Tue, 28 Jan 2014 09:09:34 +0100 Date: Tue, 28 Jan 2014 09:09:33 +0100 (CET) From: Andreas Joseph Krogh To: pgsql-jdbc@postgresql.org Message-ID: In-Reply-To: Subject: Re: Will Connection.createBlob be implemented any time soon? MIME-Version: 1.0 X-Mailer: OfficeNet Mail 1.9.0-SNAPSHOT X-Pg-Spam-Score: -2.4 (--) Content-Type: multipart/alternative; boundary="----=_Part_12_654367937.1390896573815" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org ------=_Part_10_581818831.1390896573805 Content-Type: multipart/related; boundary="----=_Part_11_1136047826.1390896573805" ------=_Part_11_1136047826.1390896573805 Content-Type: multipart/alternative; boundary="----=_Part_12_654367937.1390896573815" ------=_Part_12_654367937.1390896573815 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable P=C3=A5 tirsdag 28. januar 2014 kl. 02:40:03, skrev Tom Dunstan >: Hi Andreas On 20 January 2014 00:11, Andreas Joseph Krogh wrot= e: > I'm using JPA and need to be able to set a (new) Blob as a field, like t= his: > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0val b =3D c= on.createBlob() >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0val os =3D = b.setBinaryStream(1) >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0IOUtils.cop= yLarge(is, os, new Array[Byte](1024 * 1024)) >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0myEntity.se= tData(b) > > Where MyEntity has a field "data" which is of type "Blob" I was under the impression that most JPA implementations will allow you to stick a byte[] as your property type and will handle the rest under the good (usually using the blob support in PreparedStatement). Is that an option for you, or do you need the streaming functionality? =C2= =A0 I=20 need streaming yes, that's why I use Blobs. =C2=A0 -- Andreas Joseph Krogh =C2=A0 =C2=A0 =C2=A0 mob: +47 9= 09 56 963 Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no Public key: http://home.officenet.no/~andreak/public_key.asc =C2=A0 ------=_Part_12_654367937.1390896573815 Content-Type: text/html;charset=UTF-8 Content-Transfer-Encoding: quoted-printable
P=C3=A5 tirsdag 28. januar 2014 kl. 02:40:03, skrev Tom Dunstan <pgsql@tomd.cc>:
Hi = Andreas

On 20 January 2014 00:11, Andreas Joseph Krogh <andreak@officenet.no>= wrote:
> I'm using JPA and need to be able to set a (new) Blob as a field, like= this:
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0val b =3D= con.createBlob()
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0val os = =3D b.setBinaryStream(1)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0IOUtils.c= opyLarge(is, os, new Array[Byte](1024 * 1024))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0myEntity.= setData(b)
>
> Where MyEntity has a field "data" which is of type "Blo= b"

I was under the impression that most JPA implementations will allow
you to stick a byte[] as your property type and will handle the rest
under the good (usually using the blob support in PreparedStatement).
Is that an option for you, or do you need the streaming functionality?
=C2=A0
I need streaming yes, that's why I use Blobs.
=C2=A0
--
Andreas Joseph Krogh <andreak@officenet.no>=C2=A0 =C2=A0 =C2=A0 mob: = +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no Public key: http://home.officenet.no/~andreak/public_key.asc
=C2=A0
------=_Part_12_654367937.1390896573815-- ------=_Part_11_1136047826.1390896573805-- ------=_Part_10_581818831.1390896573805--