覆盖 Spring Roo 实体方法
我正在使用 Spring Roo,我需要覆盖 Roo_Entity.aj 文件中的 Roo 的 Remove() 方法。尽管我认为我的 JPA 注释是正确的,但当我尝试删除实体时,我遇到了很多外键约束错误。
我想做的是覆盖 Roo_Entity.aj 文件中的 Remove() 方法,以在事务提交之前手动检查外键并删除有问题的记录。
我在 .java 文件中创建了自己的 Remove() 方法,但是 Roo 不会自动更新 Roo_Entity.aj 文件,我必须手动删除和编辑 .aj 文件。 Roo 是否应该认识到我已在 .java 文件中手动创建了 Remove() 方法并相应地管理 Roo_entity.aj 文件?
提前致谢!
I'm working with Spring Roo and I need to overwrite Roo's Remove() method in the Roo_Entity.aj file. I'm getting a lot of Foreign Key constraint errors when I try to delete my entity, although I think my JPA annotations are correct.
What I'm trying to do is overwrite the Remove() method in the Roo_Entity.aj file, to manually check for foreign keys and remove the offending records before my transaction commits.
I've created my own Remove() method in my .java file, however Roo is not updating the Roo_Entity.aj file automatically and I've had to manually delete and edit the .aj file. Should Roo recognise that I've manually created a Remove() method in my .java file and manage the Roo_entity.aj file accordingly?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,Roo Shell 应该会看到您已在实体类中实现了remove(),并自动从Roo_Entity.aj 中将其删除。如果它不适合您,需要检查一些事项:
一般来说,您永远不必手动编辑 Roo_*.aj 文件。
Yes, the Roo Shell should see that you have implemented the remove() in your entity class and remove it from Roo_Entity.aj automatically. Some things to check if it's not working for you:
In general, you should never have to edit the Roo_*.aj files manually.