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