Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id C0CC463283D for ; Wed, 28 Jul 2010 23:29:09 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 78485-08 for ; Thu, 29 Jul 2010 02:29:01 +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 543FC6325D7 for ; Wed, 28 Jul 2010 23:29:01 -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 60C659F69; Thu, 29 Jul 2010 10:28:57 +0800 (WST) Received: from [10.0.0.53] (wallace.localnet [10.0.0.53]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 03F3AAE22A; Thu, 29 Jul 2010 10:28:38 +0800 (WST) Message-ID: <4C50E5B8.7030409@postnewspapers.com.au> Date: Thu, 29 Jul 2010 10:21:44 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 MIME-Version: 1.0 To: Guy Rouillier CC: pgsql-jdbc@postgresql.org Subject: Re: JPA and desktop apps References: <4C47B5F7.4050303@postnewspapers.com.au> <4C4E832B.20101@postnewspapers.com.au> <4C4F4313.8090901@burntmail.com> In-Reply-To: <4C4F4313.8090901@burntmail.com> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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, T_FRT_PROFILE2=0.01, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/122 X-Sequence-Number: 20787 On 28/07/10 04:35, Guy Rouillier wrote: > Our team is proficient in SQL and JDBC, so we wanted something that > would take care of all the routine housekeeping but would not be as > bloated as JPA or Hibernate. We settled on MyBatis > (http://www.mybatis.org/) formerly iBATIS. How did you find that it played with Pg features like: - Custom and domain types - User/role security - column privileges ? I had to fiddle a bit to make Hibernate play well with per-user logins. It wants a single all-powerful database login and security implemented in the app. I prefer someone else's already-tested security system to inventing my own, so I was using user rights in the database. I had issues making Hibernate log in with a dynamic username/password, though they weren't overly difficult to overcome. It also took some fiddling to make Hibernate only list changed columns in UPDATE and INSERT queries so it'd play well with column privileges. iBatis / MyBatis looks *much* more like what I'm after in most ways, but I'm a bit concerned about managing column privs. If simple INSERT/UPDATE queries are hand-coded then it's going to take some interesting fiddling to avoid trying to touch columns a user doesn't have the rights to update. I'm concerned I'd have to write too many very similar queries. In this particular area, Hibernate is a real boon - well, once I convinced it to generate dynamic queries. The security model isn't so complex that I can't just have a few different UPDATE queries for different rights levels, but I'm hoping to avoid it. Have you dealt with this? Or do you not use column privs? I'm still cursing the design of column privs in SQL. Requiring that cols not even be listed in an UPDATE if you don't have UPDATE rights to them - argh! It should be allowed to UPDATE a column to an identical value, ie UPDATE x SET a = 'old-value-of-a' so long as you have at least SELECT rights on that column. I'm sure there are good reasons it's how it is, but it really, really stinks from an application dev point of view, and SQL didn't need any more clumsy dynamic query construction crap than we already have to deal with. -- Craig Ringer Tech-related writing: http://soapyfrogs.blogspot.com/