Hibernate version: 3.3.2
Hi,
I know that using the output of HBM2DDL update directly on a database is not a good idea, especially on production systems. However, I'm interested to know what the "official" policy is (if there is one) on future changes/enhancements to the generation of more complete database schema upgrade scripts.
I've read somewhere that the main reason for the limited functionality, within the HBM2DDL update, is due to some JDBC drivers not returning all the metadata that would be required to generate a more complete upgrade script. Is this correct? If so, is there information about what JDBC drivers limit the metadata? Are there future changes listed in order to be able to use the extra metadata that some JDBC drivers produce? I know this would then produce inconsistent functionality across databases; I suppose at the moment the code fits the lowest common metadata produced.
One thing that I've noticed during my testing is that increases in attribute sizes within an Hibernate mapping file are not reflected in increased column sizes. For example, a varchar(20) column is not changed when the mapping definition is increased. Similarly, a change in the mapping file from a short to a long is, again, not reflected in the schema.
Is this because of the limited metadata or simply missing functionality?
Another thing that would be useful is an exception being thrown from the upgrade script generation if an existing column is found to be an incorrect type and can't be converted. For example, a varchar() column that is no defined as an int in the mapping.
It would be nice if the tool could generate as near complete an upgrade script as possible, and inform you of any issues it has found during the generation of the upgrade script.
As I mentioned before, the main aim of this topic is to get an idea on what the official position is on the HBM2DDL tool. This is more so I can look at alternative methods, justify why certain requirements for our project cannot be fulfilled and back up my assertions that generated upgrade scripts should *not* be used without being hand crafted.
Thanks.
PS. Is there anywhere in the Hibernate documentation that lists the limitations of the HBM2DDL tool and best practices when generating the various SQL scripts?
|