pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: Guy Rouillier <guyr-ml1@burntmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: JPA and desktop apps
Date: Thu, 29 Jul 2010 10:21:44 +0800
Message-ID: <4C50E5B8.7030409@postnewspapers.com.au> (raw)
In-Reply-To: <4C4F4313.8090901@burntmail.com>
References: <4C47B5F7.4050303@postnewspapers.com.au>
	<i2c31v$elh$1@news.albasani.net>
	<4C4E832B.20101@postnewspapers.com.au>
	<4C4F4313.8090901@burntmail.com>

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/



view thread (14+ messages)  latest in thread

Message-ID: <4C50E5B8.7030409@postnewspapers.com.au>
Permalink:  ../4C50E5B8.7030409@postnewspapers.com.au/
Also on:    postgresql.org/message-id/4C50E5B8.7030409@postnewspapers.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: craig@postnewspapers.com.au, guyr-ml1@burntmail.com
  Subject: Re: JPA and desktop apps
  In-Reply-To: <4C50E5B8.7030409@postnewspapers.com.au>
  References: <4C47B5F7.4050303@postnewspapers.com.au> <i2c31v$elh$1@news.albasani.net> <4C4E832B.20101@postnewspapers.com.au> <4C4F4313.8090901@burntmail.com> <4C50E5B8.7030409@postnewspapers.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox