문제

I was curious if it is possible to add a SQL header comment to the sql generated by the hbm2ddl output.

Specifically, it would be nice if I could add generated version strings to the Dialect object that would be output to the generated .sql file.

public static MyDialect extends MySQLDialect {
 // what method do I @Override to generate the comment?
}
도움이 되었습니까?

해결책

The answer (to my own question) is that you cannot currently do this. The current version of hibernate (version 4.alpha 03/2011). Their github master SchemaExporter class (https://github.com/hibernate/hibernate-core/blob/master/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SchemaExport.java) only outputs two things to the file 1) the drop table commands then 2) the table creation commands.

If I get time maybe I'll add the feature. The idea is that we could add database versioning to the generated script as a comment header.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top