Hello everyone,
During the last two weeks, I've been developing a small framework
allowing to create mappings on the fly, all the while allowing
existing sessions to "fail gracefully" (ie, if their session fails to
find a previously mapped column or table, they try with a newer
session). I don't use POJOs, so this makes it relatively easy.
This means I have to do DDL on the fly. Steven Ebersole has pointed me
to the Schema* classes in org.hibernate.hbm2ddl. The current abilities
include adding a table, adding columns to a table and removing a table
(a Configuration object with only the validated mapping of the table
to drop will do the trick nicely). But the DDL capabilities are
lacking:
* Hibernate won't drop a column, by choice, and it currently doesn't
give the user a choice because it cannot do so internally AFAICS;
* it won't add indices when requested, even with hbm2ddl=update;
And others.
Steven has pointed to a Jira task talking about an overhaul of the
Dialect abstract class and all its derivatives, because for one, the
Dialect doesn't provide "purpose oriented" capabilities, just one big
lump of methods. After looking at the code (3.3.1), I can see that
this is the case: for instance, there's no separation between DML and
DDL.
I wish to help. But I'd like to know what you, seasoned Hibernate
developers, would like to see. From the on, I'll put together
proposals and, if one is accepted, I'll start working on it. I don't
have one ready right now, the main reason for it being that I don't
fully grasp the internal Hibernate architecture yet. Is there a class
diagram available somewhere?
Thanks,
--
Francis Galiegue, fgaliegue(a)gmail.com
"It seems obvious [...] that at least some 'business intelligence'
tools invest so much intelligence on the business side that they have
nothing left for generating SQL queries" (Stéphane Faroult, in "The
Art of SQL", ISBN 0-596-00894-5)