Re: Does anyone use postgreSQL(windows version)+Hibernate with middlegen?

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: rolandpeng <rolandpeng(at)cht(dot)com(dot)tw>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Does anyone use postgreSQL(windows version)+Hibernate with middlegen?
Date: 2009-04-17 03:20:40
Message-ID: 49E7F588.6070409@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

rolandpeng wrote:

> How do you resolve this problem? or If you use postgreSQL+Hibernate3,how do
> you maintain your *.hbm.xml and entities?

I use Hibernate 3 with PostgreSQL via JPA (Hibernate EntityManager). I
maintain my entity definitions by hand.

I find generated solutions to generally be unsatisfactory. They don't
tend to preserve my customizations for eager/lazy fetching,
updatability, etc, nor my entity initialization changes. They don't
generally handle domain types all that well, and they don't always pick
the best type to map for a PostgreSQL field.

They tend to clobber my documentation, too.

They have a lot of trouble with things like NOT NULL fields that are set
by a server-side trigger, so the client application *MUST* *NOT* set
them on INSERT even though they're NOT NULL in the schema. Yet I have
one problem that I have only been able to solve in exactly this way.
It's easy to handle in a custom binding (set nullable=true,
updatable=false) but binding generators just don't and can't have that
kind of knowledge.

Bindings generators are useful as a starting point, but unless your
schema is really rather simple I'm not convinced about their long-term
utility.

--
Craig Ringer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message rolandpeng 2009-04-17 03:38:33 Re: Does anyone use postgreSQL(windows version)+Hibernate with middlegen?
Previous Message Irwan Hendra 2009-04-17 01:50:46 postgres cascade weird behaviour