gpt4 book ai didi

hibernate - 如何让 Hibernate 在它创建的表/字段上添加注释

转载 作者:行者123 更新时间:2023-12-03 06:54:48 40 4
gpt4 key购买 nike

我希望 Hibernate 在生成 DDL 时包含来 self 的 java 源代码的注释。我很乐意将其作为注释或 javadoc 标记来执行。

IOW:我希望能够去

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

并且(在oracle中),hibernate应该生成

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';

是否有注释、文档标签、配置选项等来执行此操作?

最佳答案

来自 hibernate 文档...

SchemaExport is a Hibernate utility which 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 mapped identifier generators.

doc

schemaexport 实用程序如何帮助开发,而不是用于维护或生产。 Hibernate: hbm2ddl.auto=update in production?

关于hibernate - 如何让 Hibernate 在它创建的表/字段上添加注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10569167/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com