Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 3EFEE10E9003 for ; Sun, 8 Jan 2012 13:42:45 -0400 (AST) Received: from lo.gmane.org ([80.91.229.12]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RjwlX-0007cH-Ha for pgsql-general@postgresql.org; Sun, 08 Jan 2012 17:42:45 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RjwlK-0008PF-8q for pgsql-general@postgresql.org; Sun, 08 Jan 2012 18:42:30 +0100 Received: from host-188-174-152-164.customer.m-online.net ([188.174.152.164]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 08 Jan 2012 18:42:30 +0100 Received: from spam_eater by host-188-174-152-164.customer.m-online.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 08 Jan 2012 18:42:30 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-general@postgresql.org From: Thomas Kellerer Subject: Re: Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues Date: Sun, 08 Jan 2012 18:43:04 +0100 Lines: 16 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: host-188-174-152-164.customer.m-online.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 In-Reply-To: X-Pg-Spam-Score: -4.2 (----) X-Archive-Number: 201201/152 X-Sequence-Number: 183806 Stefan Keller wrote on 06.01.2012 19:04: > I maintain images (from Webcams). In the Java and Hibernate (JPA) code > I specified a @Lob annotation on class MyData and a attribte/data type > "byte[] mydata;". Hibernate then generates two tables in PostgreSQL, > one called MyData with a column mydata of type oid and an internal one > called pg_largobjects (which contain foreign keys to the oid). That's > also explained in the JDBC docs [1], saying "PostgreSQL provides two > distinct ways to store binary data. Binary data can be stored in a > table using the data type bytea or by using the Large Object feature > which stores the binary data in a separate table in a special format > and refers to that table by storing a value of type oid in your > table." I think you are better off using bytea unless you need to access only parts of the blob regularly.