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