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.
我们目前正在参与一个暂存环境。在供应商的无限智慧中,他们使用复合主键来表示关系,这意味着如果我更新关系,我会更新键并破坏登台服务。
有没有办法拦截某些映射类的更新请求,将它们变成创建?
您可以将 Hibernate 实体配置为使用复合键。也许这会有所帮助。
如果您需要在 Hibernate 中拦截某些操作,您可以使用回调。
如果您需要更大的灵活性,请考虑使用AspectJ(使用 Spring 非常简单)。它们允许拦截任何可以想象的东西。