From felix@serhmatica.com.br Fri Apr 9 14:35:19 2010 Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id BA31F633BB4 for ; Fri, 9 Apr 2010 11:35:19 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 13634-08 for ; Fri, 9 Apr 2010 14:34:59 +0000 (UTC) X-Greylist: delayed 00:08:57.141645 by SQLgrey-1.7.6 Received: from mail.serhmatica.com.br (200-101-192-3.fnsce7004.e.brasiltelecom.net.br [200.101.192.3]) by mail.postgresql.org (Postfix) with ESMTP id 4E5E8632710 for ; Fri, 9 Apr 2010 11:35:08 -0300 (ADT) Received: from [192.168.254.60] (unknown [192.168.254.60]) by mail.serhmatica.com.br (Postfix) with ESMTPA id 18C766C4576 for ; Fri, 9 Apr 2010 11:02:40 -0300 (BRT) Message-ID: <4BBF38F9.3080708@serhmatica.com.br> Date: Fri, 09 Apr 2010 11:26:01 -0300 From: Rafael Felix User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Migration to Hibernate 3.5 final Content-Type: multipart/alternative; boundary="------------060307080400040708030801" X-Serhmatica-MailScanner-Information: Please contact the ISP for more information X-Serhmatica-MailScanner-ID: 18C766C4576.A87CE X-Serhmatica-MailScanner: Found to be clean X-Serhmatica-MailScanner-From: felix@serhmatica.com.br X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.365 tagged_above=-10 required=5 tests=HTML_MESSAGE=0.001, RDNS_DYNAMIC=0.363, TO_NO_BRKTS_DYNIP=0.001 X-Spam-Level: X-Archive-Number: 201004/13 X-Sequence-Number: 20424 This is a multi-part message in MIME format. --------------060307080400040708030801 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit I´ve an application running in hibernate 3.3.2 and the applications works fine, with all blob fields using oid (byte[] in java), Migrating to hibernate 3.5 all blob fields not work anymore, and the server log shows ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: column "preferencia" is of type oid but expression is of type bytea But I'm cann't change the tables struct for use bytea instead oid, because I lost all data. How I can solve it? Or How can I migrate de OID field to bytea field. regards -- *Rafael Guzi Felix da Silva* *Desenvolvedor de Sistemas* Serhmatica Sistemas e Serviços de Informática Telefone: (49) 3566 1303 -- Serhmatica visite: www.serhmatica.com.br Esta mensagem foi verificada pelo sistema de antivírus e acredita-se estar livre de perigo. --------------060307080400040708030801 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I´ve an application running in hibernate 3.3.2 and the applications works fine, with all blob fields using oid (byte[] in java),
Migrating to hibernate 3.5 all blob fields not work anymore, and the server log shows

ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: column "preferencia" is of type oid but expression is of type bytea

But I'm cann't change the tables struct for use bytea instead oid, because I lost all data.
How I can solve it? Or How can I migrate de OID field to bytea field.


regards
--
Rafael Guzi Felix da Silva
Desenvolvedor de Sistemas
Serhmatica Sistemas e Serviços de Informática
Telefone: (49) 3566 1303

--
Serhmatica
Visite www.serhmatica.com.br
Esta mensagem foi verificada pelo sistema de antivírus e
acredita-se estar livre de perigo. --------------060307080400040708030801-- From felix@serhmatica.com.br Fri Apr 9 14:37:31 2010 Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 0B7DD632333 for ; Fri, 9 Apr 2010 11:37:31 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 14076-02 for ; Fri, 9 Apr 2010 14:37:11 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.serhmatica.com.br (200-101-192-3.fnsce7004.e.brasiltelecom.net.br [200.101.192.3]) by mail.postgresql.org (Postfix) with ESMTP id 1AB2E6328BE for ; Fri, 9 Apr 2010 11:37:20 -0300 (ADT) Received: from [192.168.254.60] (unknown [192.168.254.60]) by mail.serhmatica.com.br (Postfix) with ESMTPA id 928F26C4576 for ; Fri, 9 Apr 2010 11:13:53 -0300 (BRT) Message-ID: <4BBF3B9A.9070607@serhmatica.com.br> Date: Fri, 09 Apr 2010 11:37:14 -0300 From: Rafael Felix User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Migration to Hibernate 3.5 final Content-Type: multipart/alternative; boundary="------------020905000003010105050008" X-Serhmatica-MailScanner-Information: Please contact the ISP for more information X-Serhmatica-MailScanner-ID: 928F26C4576.A80A0 X-Serhmatica-MailScanner: Found to be clean X-Serhmatica-MailScanner-From: felix@serhmatica.com.br X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.365 tagged_above=-10 required=5 tests=HTML_MESSAGE=0.001, RDNS_DYNAMIC=0.363, TO_NO_BRKTS_DYNIP=0.001 X-Spam-Level: X-Archive-Number: 201004/12 X-Sequence-Number: 20423 This is a multi-part message in MIME format. --------------020905000003010105050008 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit I´ve an application running in hibernate 3.3.2 and the applications works fine, with all blob fields using oid (byte[] in java), Migrating to hibernate 3.5 all blob fields not work anymore, and the server log shows ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: column "preferencia" is of type oid but expression is of type bytea But I'm cann't change the tables struct for use bytea instead oid, because I lost all data. How I can solve it? Or How can I migrate de OID field to bytea field. regards -- *Rafael Guzi Felix da Silva* *Desenvolvedor de Sistemas* Serhmatica Sistemas e Serviços de Informática Telefone: (49) 3566 1303 -- Serhmatica visite: www.serhmatica.com.br Esta mensagem foi verificada pelo sistema de antivírus e acredita-se estar livre de perigo. --------------020905000003010105050008 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I´ve an application running in hibernate 3.3.2 and the applications works fine, with all blob fields using oid (byte[] in java),
Migrating to hibernate 3.5 all blob fields not work anymore, and the server log shows

ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: column "preferencia" is of type oid but expression is of type bytea

But I'm cann't change the tables struct for use bytea instead oid, because I lost all data.
How I can solve it? Or How can I migrate de OID field to bytea field.


regards
--
Rafael Guzi Felix da Silva
Desenvolvedor de Sistemas
Serhmatica Sistemas e Serviços de Informática
Telefone: (49) 3566 1303

--
Serhmatica
Visite www.serhmatica.com.br
Esta mensagem foi verificada pelo sistema de antivírus e
acredita-se estar livre de perigo. --------------020905000003010105050008-- From craig@postnewspapers.com.au Sat Apr 10 11:37:01 2010 Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id A0D386328F5 for ; Sat, 10 Apr 2010 08:37:01 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 21414-02 for ; Sat, 10 Apr 2010 11:36:35 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by mail.postgresql.org (Postfix) with ESMTP id D31B763287B for ; Sat, 10 Apr 2010 08:36:50 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 8646BAF045; Sat, 10 Apr 2010 19:34:38 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail2.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id o0SxdUsnUJLf; Sat, 10 Apr 2010 19:34:33 +0800 (WST) Received: from [10.1.1.5] (203-206-36-38.dyn.iinet.net.au [203.206.36.38]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id 626E2AF0B8; Sat, 10 Apr 2010 19:34:33 +0800 (WST) Message-ID: <4BC062CA.9050104@postnewspapers.com.au> Date: Sat, 10 Apr 2010 19:36:42 +0800 From: Craig Ringer User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Rafael Felix CC: pgsql-jdbc@postgresql.org Subject: Re: Migration to Hibernate 3.5 final References: <4BBF3B9A.9070607@serhmatica.com.br> In-Reply-To: <4BBF3B9A.9070607@serhmatica.com.br> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.698 tagged_above=-10 required=5 tests=AWL=-0.698 X-Spam-Level: X-Archive-Number: 201004/14 X-Sequence-Number: 20425 Rafael Felix wrote: > I´ve an application running in hibernate 3.3.2 and the applications > works fine, with all blob fields using oid (byte[] in java), Do you mean you're using the literal type `oid' in the Pg fields? Or are you using the `lo' contrib type? By using the `oid' type you're using out-of-line large objects, referenced by object id (oid). If you use `oid' directly, then when you delete a row from your table the corresponding large object will NOT be deleted. The `lo' wrapper contrib type provides that. It's not in mainline yet (alas), perhaps because it can't guarantee correctness - in particular a TRUNCATE TABLE will still leak large objects. > Migrating to hibernate 3.5 all blob fields not work anymore, and the > server log shows > > ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: column > "preferencia" is of type oid but expression is of type bytea OK, so you're now mapping byte[] to the Pg type 'bytea' instead of to pg large objects. You can change this mapping in your hibernate settings if you want things to go back to how they were. See large object mapping in the Hibernate documentation. > But I'm cann't change the tables struct for use bytea instead oid, > because I lost all data. Do you mean "because you've lost all your data" or "because by doing so you will lose all your data"? I presume the latter. What I'd do would be: a) Change hibernate's mapping for byte[] back to large object instead of bytea by overriding it in the Hibernate configuration b) Evaluate whether bytea or large object is actually better for you by reading the postgresql documentation and thinking a about your needs. Consider how often you update the data, how big the maximum size of object you need to store is, etc. c) Decide whether you should migrate to bytea or stick with large objects. d) If you stick to large objects, switch from raw oid types to `lo' types, so you get proper large object cleanup on delete/update. Consider using vacuumlo . -- Craig Ringer From rsmogura@softperience.eu Sat Apr 10 12:59:06 2010 Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 77999633152 for ; Sat, 10 Apr 2010 09:59:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 81983-06 for ; Sat, 10 Apr 2010 12:58:56 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from progressive.micfo.com (progressive.micfo.com [174.34.188.2]) by mail.postgresql.org (Postfix) with ESMTP id 17027632BDF for ; Sat, 10 Apr 2010 09:58:55 -0300 (ADT) Received: from 87-204-194-135.dg-net.pl ([87.204.194.135]:55001 helo=radek.localnet) by progressive.micfo.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1O0aGx-0005ia-Cm for pgsql-jdbc@postgresql.org; Sat, 10 Apr 2010 07:58:51 -0500 To: pgsql-jdbc@postgresql.org Subject: Re: Migration to Hibernate 3.5 final From: =?utf-8?q?Rados=C5=82aw_Smogura?= Date: Sat, 10 Apr 2010 14:58:54 +0200 MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201004101458.54501.rsmogura@softperience.eu> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - progressive.micfo.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - softperience.eu X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=-10 required=5 tests=none X-Spam-Level: X-Archive-Number: 201004/15 X-Sequence-Number: 20426 I had similar problems, try use on byte[] field following Hibernate annotat= ion=20 @Type(type=3D"org.hibernate.type.PrimitiveByteArrayBlobType") Dnia sobota 10 kwiecie=C5=84 2010 o 13:36:42 Craig Ringer napisa=C5=82(a): > Rafael Felix wrote: > > I=C2=B4ve an application running in hibernate 3.3.2 and the applications > > works fine, with all blob fields using oid (byte[] in java), >=20 > Do you mean you're using the literal type `oid' in the Pg fields? Or are > you using the `lo' contrib type? >=20 > By using the `oid' type you're using out-of-line large objects, > referenced by object id (oid). >=20 > If you use `oid' directly, then when you delete a row from your table > the corresponding large object will NOT be deleted. The `lo' wrapper > contrib type provides that. It's not in mainline yet (alas), perhaps > because it can't guarantee correctness - in particular a TRUNCATE TABLE > will still leak large objects. >=20 > > Migrating to hibernate 3.5 all blob fields not work anymore, and the > > server log shows > > > > ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: column > > "preferencia" is of type oid but expression is of type bytea >=20 > OK, so you're now mapping byte[] to the Pg type 'bytea' instead of to pg > large objects. >=20 > You can change this mapping in your hibernate settings if you want > things to go back to how they were. See large object mapping in the > Hibernate documentation. >=20 > > But I'm cann't change the tables struct for use bytea instead oid, > > because I lost all data. >=20 > Do you mean "because you've lost all your data" or "because by doing so > you will lose all your data"? >=20 > I presume the latter. >=20 > What I'd do would be: >=20 > a) Change hibernate's mapping for byte[] back to large object instead of > bytea by overriding it in the Hibernate configuration >=20 > b) Evaluate whether bytea or large object is actually better for you by > reading the postgresql documentation and thinking a about your needs. > Consider how often you update the data, how big the maximum size of > object you need to store is, etc. >=20 > c) Decide whether you should migrate to bytea or stick with large objects. >=20 > d) If you stick to large objects, switch from raw oid types to `lo' > types, so you get proper large object cleanup on delete/update. Consider > using vacuumlo . >=20 > -- > Craig Ringer >=20 From felix@serhmatica.com.br Mon Apr 12 11:46:11 2010 Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id A8205633883 for ; Mon, 12 Apr 2010 08:46:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 66750-04 for ; Mon, 12 Apr 2010 11:46:00 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.serhmatica.com.br (200-101-192-3.fnsce7004.e.brasiltelecom.net.br [200.101.192.3]) by mail.postgresql.org (Postfix) with ESMTP id 1C397633479 for ; Mon, 12 Apr 2010 08:45:59 -0300 (ADT) Received: from [192.168.254.60] (unknown [192.168.254.60]) by mail.serhmatica.com.br (Postfix) with ESMTPA id 7077E6C44A2 for ; Mon, 12 Apr 2010 08:22:05 -0300 (BRT) Message-ID: <4BC307ED.7070801@serhmatica.com.br> Date: Mon, 12 Apr 2010 08:45:49 -0300 From: Rafael Felix User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: Migration to Hibernate 3.5 final References: <201004101458.54501.rsmogura@softperience.eu> In-Reply-To: <201004101458.54501.rsmogura@softperience.eu> Content-Type: multipart/alternative; boundary="------------010409070608030705090403" X-Serhmatica-MailScanner-Information: Please contact the ISP for more information X-Serhmatica-MailScanner-ID: 7077E6C44A2.A801D X-Serhmatica-MailScanner: Found to be clean X-Serhmatica-MailScanner-From: felix@serhmatica.com.br X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.365 tagged_above=-10 required=5 tests=HTML_MESSAGE=0.001, RDNS_DYNAMIC=0.363, TO_NO_BRKTS_DYNIP=0.001 X-Spam-Level: X-Archive-Number: 201004/18 X-Sequence-Number: 20429 This is a multi-part message in MIME format. --------------010409070608030705090403 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Radoslaw and Craig, Thanks for ansewers, the @Type annotations was worked for me. About the Craig questions, I'm using the literal oid field. Thanks for all regards Em 10/4/2010 09:58, RadosÅ‚aw Smogura escreveu: > I had similar problems, try use on byte[] field following Hibernate annotation > @Type(type="org.hibernate.type.PrimitiveByteArrayBlobType") > > Dnia sobota 10 kwiecieÅ„ 2010 o 13:36:42 Craig Ringer napisaÅ‚(a): > >> Rafael Felix wrote: >> >>> I´ve an application running in hibernate 3.3.2 and the applications >>> works fine, with all blob fields using oid (byte[] in java), >>> >> Do you mean you're using the literal type `oid' in the Pg fields? Or are >> you using the `lo' contrib type? >> >> By using the `oid' type you're using out-of-line large objects, >> referenced by object id (oid). >> >> If you use `oid' directly, then when you delete a row from your table >> the corresponding large object will NOT be deleted. The `lo' wrapper >> contrib type provides that. It's not in mainline yet (alas), perhaps >> because it can't guarantee correctness - in particular a TRUNCATE TABLE >> will still leak large objects. >> >> >>> Migrating to hibernate 3.5 all blob fields not work anymore, and the >>> server log shows >>> >>> ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: column >>> "preferencia" is of type oid but expression is of type bytea >>> >> OK, so you're now mapping byte[] to the Pg type 'bytea' instead of to pg >> large objects. >> >> You can change this mapping in your hibernate settings if you want >> things to go back to how they were. See large object mapping in the >> Hibernate documentation. >> >> >>> But I'm cann't change the tables struct for use bytea instead oid, >>> because I lost all data. >>> >> Do you mean "because you've lost all your data" or "because by doing so >> you will lose all your data"? >> >> I presume the latter. >> >> What I'd do would be: >> >> a) Change hibernate's mapping for byte[] back to large object instead of >> bytea by overriding it in the Hibernate configuration >> >> b) Evaluate whether bytea or large object is actually better for you by >> reading the postgresql documentation and thinking a about your needs. >> Consider how often you update the data, how big the maximum size of >> object you need to store is, etc. >> >> c) Decide whether you should migrate to bytea or stick with large objects. >> >> d) If you stick to large objects, switch from raw oid types to `lo' >> types, so you get proper large object cleanup on delete/update. Consider >> using vacuumlo . >> >> -- >> Craig Ringer >> >> > -- *Rafael Guzi Felix da Silva* *Desenvolvedor de Sistemas* Serhmatica Sistemas e Serviços de Informática Telefone: (49) 3566 1303 -- Serhmatica visite: www.serhmatica.com.br Esta mensagem foi verificada pelo sistema de antivírus e acredita-se estar livre de perigo. --------------010409070608030705090403 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Radoslaw and Craig,

Thanks for ansewers, the @Type annotations was worked for me.

About the Craig questions, I'm using the literal oid field.

Thanks for all

regards

Em 10/4/2010 09:58, Radosław Smogura escreveu:
I had similar problems, try use on byte[] field following Hibernate annotation 
@Type(type="org.hibernate.type.PrimitiveByteArrayBlobType")

Dnia sobota 10 kwiecień 2010 o 13:36:42 Craig Ringer napisał(a):
  
Rafael Felix wrote:
    
I´ve an application running in hibernate 3.3.2 and the applications
works fine, with all blob fields using oid (byte[] in java),
      
Do you mean you're using the literal type `oid' in the Pg fields? Or are
you using the `lo' contrib type?

By using the `oid' type you're using out-of-line large objects,
referenced by object id (oid).

If you use `oid' directly, then when you delete a row from your table
the corresponding large object will NOT be deleted. The `lo' wrapper
contrib type provides that. It's not in mainline yet (alas), perhaps
because it can't guarantee correctness - in particular a TRUNCATE TABLE
will still leak large objects.

    
Migrating to hibernate 3.5 all blob fields not work anymore, and the
server log shows

ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: column
"preferencia" is of type oid but expression is of type bytea
      
OK, so you're now mapping byte[] to the Pg type 'bytea' instead of to pg
large objects.

You can change this mapping in your hibernate settings if you want
things to go back to how they were. See large object mapping in the
Hibernate documentation.

    
But I'm cann't change the tables struct for use bytea instead oid,
because I lost all data.
      
Do you mean "because you've lost all your data" or "because by doing so
you will lose all your data"?

I presume the latter.

What I'd do would be:

a) Change hibernate's mapping for byte[] back to large object instead of
bytea by overriding it in the Hibernate configuration

b) Evaluate whether bytea or large object is actually better for you by
reading the postgresql documentation and thinking a about your needs.
Consider how often you update the data, how big the maximum size of
object you need to store is, etc.

c) Decide whether you should migrate to bytea or stick with large objects.

d) If you stick to large objects, switch from raw oid types to `lo'
types, so you get proper large object cleanup on delete/update. Consider
using vacuumlo .

--
Craig Ringer

    
  


--
Rafael Guzi Felix da Silva
Desenvolvedor de Sistemas
Serhmatica Sistemas e Serviços de Informática
Telefone: (49) 3566 1303

--
Serhmatica
Visite www.serhmatica.com.br
Esta mensagem foi verificada pelo sistema de antivírus e
acredita-se estar livre de perigo. --------------010409070608030705090403-- From rsmogura@softperience.eu Mon Apr 12 16:29:22 2010 Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id E21DC6358F1 for ; Mon, 12 Apr 2010 13:29:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 06101-09-2 for ; Mon, 12 Apr 2010 16:28:53 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from progressive.micfo.com (progressive.micfo.com [174.34.188.2]) by mail.postgresql.org (Postfix) with ESMTP id 2113263582D for ; Mon, 12 Apr 2010 13:28:37 -0300 (ADT) Received: from 87-204-194-135.dg-net.pl ([87.204.194.135]:55010 helo=radek.localnet) by progressive.micfo.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1O1MUy-0001lI-P6 for pgsql-jdbc@postgresql.org; Mon, 12 Apr 2010 11:28:33 -0500 From: =?utf-8?q?Rados=C5=82aw_Smogura?= To: pgsql-jdbc@postgresql.org Subject: Re: Migration to Hibernate 3.5 final Date: Mon, 12 Apr 2010 18:28:52 +0200 User-Agent: KMail/1.12.4 (Linux/2.6.31-gentoo-r10; KDE/4.3.5; x86_64; ; ) References: <201004101458.54501.rsmogura@softperience.eu> <4BC307ED.7070801@serhmatica.com.br> In-Reply-To: <4BC307ED.7070801@serhmatica.com.br> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201004121828.52833.rsmogura@softperience.eu> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - progressive.micfo.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - softperience.eu X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201004/19 X-Sequence-Number: 20430 Hi, I shuold give few words of explanation, which I didn't wrote because of=20 tragedy that was on 10th Apr in Smolensk. This generaly isn't bug in PG JDBC, but change of default implementation of= =20 Hibernate in 3.5 version (it should not happen, because some old legacy=20 application, without support or source code can't be migrated to Hibernate = 3.5=20 and so to J2EE6). In my situation setting compatible property on connection= =20 didn't helped.=20 Much more this what I saw in 3.5 - beta 2, and i don't know if this was fix= ed=20 is Hibernate - without @Type annotation - will auto-create column of type o= id=20 (correct!) , but will try to read this as bytea (SIC!) Dnia poniedzia=C5=82ek 12 kwiecie=C5=84 2010 o 13:45:49 Rafael Felix napisa= =C5=82(a): > Radoslaw and Craig, >=20 > Thanks for ansewers, the @Type annotations was worked for me. >=20 > About the Craig questions, I'm using the literal oid field. >=20 > Thanks for all >=20 > regards >=20 > Em 10/4/2010 09:58, Rados=C5=82aw Smogura escreveu: > > I had similar problems, try use on byte[] field following Hibernate > > annotation @Type(type=3D"org.hibernate.type.PrimitiveByteArrayBlobType") > > > > Dnia sobota 10 kwiecie=C5=84 2010 o 13:36:42 Craig Ringer napisa=C5=82(= a): > >> Rafael Felix wrote: > >>> I=C2=B4ve an application running in hibernate 3.3.2 and the applicati= ons > >>> works fine, with all blob fields using oid (byte[] in java), > >> > >> Do you mean you're using the literal type `oid' in the Pg fields? Or a= re > >> you using the `lo' contrib type? > >> > >> By using the `oid' type you're using out-of-line large objects, > >> referenced by object id (oid). > >> > >> If you use `oid' directly, then when you delete a row from your table > >> the corresponding large object will NOT be deleted. The `lo' wrapper > >> contrib type provides that. It's not in mainline yet (alas), perhaps > >> because it can't guarantee correctness - in particular a TRUNCATE TABLE > >> will still leak large objects. > >> > >>> Migrating to hibernate 3.5 all blob fields not work anymore, and the > >>> server log shows > >>> > >>> ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: column > >>> "preferencia" is of type oid but expression is of type bytea > >> > >> OK, so you're now mapping byte[] to the Pg type 'bytea' instead of to = pg > >> large objects. > >> > >> You can change this mapping in your hibernate settings if you want > >> things to go back to how they were. See large object mapping in the > >> Hibernate documentation. > >> > >>> But I'm cann't change the tables struct for use bytea instead oid, > >>> because I lost all data. > >> > >> Do you mean "because you've lost all your data" or "because by doing so > >> you will lose all your data"? > >> > >> I presume the latter. > >> > >> What I'd do would be: > >> > >> a) Change hibernate's mapping for byte[] back to large object instead = of > >> bytea by overriding it in the Hibernate configuration > >> > >> b) Evaluate whether bytea or large object is actually better for you by > >> reading the postgresql documentation and thinking a about your needs. > >> Consider how often you update the data, how big the maximum size of > >> object you need to store is, etc. > >> > >> c) Decide whether you should migrate to bytea or stick with large > >> objects. > >> > >> d) If you stick to large objects, switch from raw oid types to `lo' > >> types, so you get proper large object cleanup on delete/update. Consid= er > >> using vacuumlo . > >> > >> -- > >> Craig Ringer >=20