简体   繁体   English

由于 springboot 错误的审计名称列导致架构失效

[英]Invalidation schema due to wrong audit name column with springboot

I'm currently working on a rest api for a old java application using springboot.我目前正在为使用 springboot 的旧 Java 应用程序开发一个 rest api。

When I scan my entities, I have :当我扫描我的实体时,我有:

org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing column [rev] in table [schema.object_aud].

Indeed, my rev column is named "revision_id".事实上,我的 rev 列名为“revision_id”。

I don't want to change this name because it's used in many applications and I don't want side effects...我不想更改此名称,因为它已在许多应用程序中使用,而且我不想要副作用...

How can I configure bootstrap to check that name instead of "rev".如何配置引导程序以检查该名称而不是“rev”。

Thank you for your help !感谢您的帮助 !

If I understood the question correctly, You have a different name of column in entity class.如果我正确理解了这个问题,您在实体类中有一个不同的列名称。 You can define your rev attriute with this annotation :您可以使用此注释定义您的 rev 属性:

@Column(name = "revision_id") @Column(name = "revision_id")

Now the validation will look for column "revision_id" in the schema.现在验证将在模式中查找列“revision_id”。

I found a solution if someone read this post : In application.yml/application.properties, I add these lines如果有人阅读这篇文章,我找到了一个解决方案:在 application.yml/application.properties 中,我添加了这些行

spring.jpa.properties:
      org.hibernate.envers.revision_field_name: revision_id
      org.hibernate.envers.revision_type_field_name: revision_type

And it's working fine.它工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM