I was wondering if it's possible to add an auto drop & auto create
schema feature to hibernate, something similar as the <create-table>
and <drop-table> in jboss-cmp.
This could be easily added inside the <class> tag as elements or as
attributes.
<class name="com.something.PersistentClass" ....>
<drop-schema>true</drop-schema>
<create-schema>true</create-schema>
.
.
</class>
or
<class name="com.something.PersistentClass"
drop-schema="true"
create-schema="true">
.
.
</class>
Implementation shouldn't be too difficult considering existing
methods Datastore.generateSchemaDropScript() and
Datastore.generateSchemaCreateScript() which I used to accomplish
this task in testing Hibernate, but I think this feature could be
very valuable for devel-time, in an automated manner, maybe at
SessionFactory construction time (for Hibernate provided db
connections).
Any opinions? Can this be considered for future implementation?
I also been thinking another solution could be extending
cirrus.hibernate.jmx.HibernateService to allow schema creation &
drop (on-demand or automatic on deploy time) but this last solution
leaves out all non-JMX Hibernate users.
Anybody?
Off course the ideal solution would be using a very smart
SchemaUpdater but I don't think it's worth the effort of creating
such a piece of software since most uses will be in development time
when we can live with the drop-create cycle even if it doesn't
always work perfectly. On the other hand, who could rely on a
SchemaUpdater on a production-time system?
Just my thoughts... (and desire)
--
Saludos,
Pablo mailto:pi...@ie...
"The only thing that interferes with my learning is my education."
Albert Einstein
|