休眠:如何删除在ManyToOne中不再引用的实体? [英] Hibernate: How to remove an entity to which none refers to anymore in ManyToOne?

查看:94
本文介绍了休眠:如何删除在ManyToOne中不再引用的实体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个实体,我们称它们为A和B,它们具有到另一个实体(例如C)的ManyToOne映射.

I have two entities, lets call them A and B, which have a ManyToOne mapping to another entity, say C

所以我通常有这样的东西:

So I typically have something like this:

a1-> c

a2-> c

b1-> c

很多A和B指向同一个C.

Lots of A's and B's pointing to the same C.

当我删除最后一个a和b时,如何让Hibernate删除c?

How do I get Hibernate to remove c when I remove the last a and b?

推荐答案

似乎JPA/Hibernate不支持此功能.这真的很糟糕.

It seems that JPA/Hibernate does not support this. Which is really bad.

这篇关于休眠:如何删除在ManyToOne中不再引用的实体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆