Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个创建分配对象的 PrePersist 回调。我需要触发回调,让我知道这些分配对象何时插入数据库。分配的 PostPersist 回调不会以这种方式触发。触发的唯一回调是 PostAdd,这对我没有帮助。我该怎么做呢?谢谢。
持久对象事件的经验法则是:
您有一种不同的情况,它正在组装由其他持久对象组成的“聚合”对象。所以我建议把这个逻辑完全从回调中取出,放到一个知道如何创建和连接对象的工厂类中。