How to get Hibernate to add comments to tables / fields that it creates?

I would like Hibernate to include comments from my java source when creating DDL. I would be happy to do this as an annotation or as a javadoc tag.

IOW: I would like to be able to go

@Entity @DDLComment "This entity is cool" class Foo { @DDLComment "But this field is kinda lame" int lame_o_rama; 

And (in oracle), hibernate should generate

 CREATE TABLE FOO ( LAME_O_RAMA number }; COMMENT ON FOO IS 'This entity is cool'; COMMENT ON FOO.LAME_O_RAMA 'But this field is kinda lame'; 

Is there an annotation, doc tag, configuration parameter, etc. etc. to do this?

+8
annotations hibernate documentation ddl
source share
1 answer

from hibernate docs ...

SchemaExport is a Hibernate utility that generates DDL from your mapping files. The generated schema includes referential integrity constraints, primary and foreign keys, for entity and collection tables. It also creates tables and sequences for display identifier generators.

doc

however, the schemaexport utility does not help in development, and not for maintenance or production. Hibernate: hbm2ddl.auto = upgrade in production?

0
source share

All Articles