Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 7901F6322B0 for ; Thu, 22 Jul 2010 00:07:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 50202-02 for ; Thu, 22 Jul 2010 03:07:44 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [202.4.227.11]) by mail.postgresql.org (Postfix) with ESMTP id 3B96C62DBEC for ; Thu, 22 Jul 2010 00:07:44 -0300 (ADT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id A14669F7E for ; Thu, 22 Jul 2010 11:07:41 +0800 (WST) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id B756EAF771 for ; Thu, 22 Jul 2010 11:04:51 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 2sJFVM2hf0eJ for ; Thu, 22 Jul 2010 11:04:46 +0800 (WST) Received: from [10.1.1.6] (124-168-255-56.dyn.iinet.net.au [124.168.255.56]) (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 730ADAE4F5 for ; Thu, 22 Jul 2010 11:04:46 +0800 (WST) Message-ID: <4C47B5F7.4050303@postnewspapers.com.au> Date: Thu, 22 Jul 2010 11:07:35 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Lightning/1.0b1 Thunderbird/3.0.4 MIME-Version: 1.0 To: PG-JDBC Mailing List Subject: JPA and desktop apps X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.51 tagged_above=-10 required=5 tests=BAYES_05=-0.5, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/72 X-Sequence-Number: 20737 Hi all This is mildly OT, so please ignore unless you're interested in and work with PostgreSQL via JPA/Hibernate/EclipseLink/etc in a desktop app setting. Ages ago, I asked here if others were using JDBC directly to access Pg from their java apps, or if they were using an ORM. I sought advice. Many suggested that an ORM was a strongly preferable option, and partly as a result of that advice I ended up using the JPA interface (with Hibernate powering it) for my database access in my Swing app. I've now concluded that, while it seems great on the surface, that approach is absolutely awful, because of issues with detatched entities, lazy property fetching, and the need to run database work on a non-EDT thread to avoid UI stalls/freezes and repaint delays. More details here: http://soapyfrogs.blogspot.com/2010/07/jpa-and-hibernateeclipselinkopenjpaetc.html Anyway, since folks here advised me to go for an ORM like Hibernate, I'm curious: How do you handle the need to avoid blocking on database access in your Java GUI apps, while lazily fetching properties of entities to avoid downloading half the database whenever you query it for anything? -- Craig Ringe