Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id E7A286322DA for ; Thu, 29 Jul 2010 03:31:00 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 40728-02 for ; Thu, 29 Jul 2010 06:30:53 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx02.burntmail.com (mx02.burntmail.com [70.87.63.122]) by mail.postgresql.org (Postfix) with ESMTP id 79517632231 for ; Thu, 29 Jul 2010 03:30:53 -0300 (ADT) Received: from [173.79.59.248] (helo=[192.168.1.60]) by mx02.burntmail.com with esmtpa (Exim 4.63) (envelope-from ) id 1OeMdo-0002bR-Uw; Thu, 29 Jul 2010 01:30:53 -0500 Message-ID: <4C512019.9010000@burntmail.com> Date: Thu, 29 Jul 2010 02:30:49 -0400 From: Guy Rouillier User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.7) Gecko/20100713 Thunderbird/3.1.1 MIME-Version: 1.0 To: Craig Ringer 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> <4C50E5B8.7030409@postnewspapers.com.au> In-Reply-To: <4C50E5B8.7030409@postnewspapers.com.au> Content-Type: text/plain; charset=UTF-8; format=flowed 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/123 X-Sequence-Number: 20788 On 7/28/2010 10:21 PM, Craig Ringer wrote: > 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 Custom types: you can implement your own TypeHandler and simply tell MyBatis to use that for specific columns. I do that, for example, to map columns containing foreign key values into Java enums. The mapping works in both directions, so once you've updated the value of a Java enum in an object and want to update the DB, MyBatis will map the enum back into the proper column value using your TypeHandler. Of course, all the default TypeHandlers are built in. Per-user logins: I haven't done that in over 10 years, i.e., long before I started using MyBatis. Just about everything I've been working on uses web-based GUIs with server-based database interactions. MyBatis comes packaged with 3 DataSource options that all use a single set of credentials. You can provide your own DataSource implementation. Column privileges: from the way you describe this, it sounds like you have some way of identifying which user logons have update rights on which columns. If that is the case, then MyBatis provides minimalist conditional expressions. Here is a ready example from some production code: where user_id = #{aUserId, javaType=String, jdbcType=VARCHAR} and trunc(timestamp) = ]]> trunc(#{dtStartDate, javaType=java.util.Date, jdbcType=DATE}) and type_id in #{item} The code is for a where clause, but you can do the same thing in the set clause of an update. I'm not a MyBatis developer, just a happy end user. It works well for what it attempts to do. But it certainly doesn't attempt to do anywhere near what JPA or Hibernate does. -- Guy Rouillier