简体   繁体   English

审计使用Spring hibernate mongodb

[英]Audit using Spring hibernate mongodb

I am looking for a design approach. 我正在寻找一种设计方法。 What i want to achieve to get all the 'old to new' changes when a entity is updated,during which also the changes to be recorded/audited into another entity. 当实体更新时,我希望实现所有“旧到新”的更改,在此期间还要将更改记录/审核到另一个实体中。 trick is former update to entiry happens in mysql using hibernate and the later entity lives in Mongo which is using morphia. 技巧是以前更新到entiry发生在使用hibernate的mysql中,而后来的实体存在于使用morphia的Mongo中。 both these provider inside my spring mvc, independently yet together. 这两个提供者都在我的春天mvc里面,独立地在一起。 they dont bother each other coz all the CRUD happens independently for their respective changes. 他们不打扰彼此因为所有CRUD独立发生各自的变化。 Last time, i tried a join with mongo and mysql using hibernate but realized that is not possible ! 上次,我尝试使用hibernate与mongo和mysql连接,但意识到这是不可能的! (not sure there is a solution ), But now I have take my audit changes to Mongo and track them there for every change in JPA/hibernate managed entities. (不确定是否有解决方案),但现在我已将我的审计更改发送到Mongo,并在那里跟踪它们,以便在JPA / hibernate管理实体中进行每次更改。

  1. I don't need a regular audit with version etc., or a additional table. 我不需要对版本等进行定期审核,也不需要额外的表格。 for each entity. 对于每个实体。
  2. Every change in any entity needs to be trailed to only one entity in mongo. 任何实体中的每个更改都需要跟踪到mongo中的一个实体。 the mongo entity/document will generic Audit log. mongo实体/文档将通用审计日志。
  3. Envers not suitable Envers不合适
  4. hibernate interceptor, fine but how i talk to mongo, do i need ogm hibernate拦截器,很好,但我如何与mongo交谈,我需要ogm
  5. hibernate listeners ? hibernate听众?
  6. spring aop 春天唉
  7. spring aop + ? 春天aop +? + ? +?
  8. will spring data can help ? 春季数据会有所帮助吗?

I have read and come up with some idea, i needs some experts to help me refine or suggest a better solution. 我已阅读并提出一些想法,我需要一些专家帮助我改进或建议更好的解决方案。

I am planning to implement spring aop and to intercept at service level, having a Audit service to set my Audit bean in order not to loose changes then in use some mechanism to get and set or flush the Audit change to the dedicated document in Mongo. 我计划实现spring aop并在服务级别进行拦截,使用Audit服务来设置我的Audit bean,以便不会丢失更改,然后使用某种机制来获取和设置或将Audit更改刷新到Mongo中的专用文档。

Not sure the above approach is meaningful and achievable. 不确定上述方法是否有意义且可实现。 Any help will be greatly appreciated. 任何帮助将不胜感激。

Audit4j支持Spring AOP支持的各种选项,但你必须为audit4j编写一个自己的MongoDB插件,目前它不可用。

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

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