首页 \ 问答 \ JPA单向@OneToMany性能(JPA unidirectional @OneToMany performance)

JPA单向@OneToMany性能(JPA unidirectional @OneToMany performance)

我有两个具有unidirectional @OneToMany Lazy关系的实体。 当我尝试添加一个孩子时,似乎Hibernate 4(我的JPA提供者)实际上正在执行

  1. 选择查询
  2. 删除连接表上具有该父ID的所有子项
  3. 在连接表上重新插入所有和新子项

如何让Hibernate只插入我想要的孩子,而不改变我的关系?


I have two entities with unidirectional @OneToMany Lazy relationship. When I try to add a child, it seems like Hibernate 4 (my JPA provider) actually performs

  1. Select query
  2. Delete all children with that parent id on join table
  3. Reinsert back all and the new child on join table

How to make Hibernate to just insert the child I wish, without changing my relationship?


原文:https://stackoverflow.com/questions/18333198
更新时间:2022-05-26 19:05

最满意答案

经过几周的搜索,我会和Drools一起去。 看起来唯一可能的选项可以满足项目的需求https://www.drools.org/


After few weeks of search , i will go with Drools. Looks like the only possible option can fit the needs for the project https://www.drools.org/

相关问答

更多
  • 您是否尝试过使用云数据存储的本地开发服务器 ? 这听起来就像你在找什么。 Have you tried using cloud datastore's local development server? It sounds like exactly what you are looking for.
  • 我看到的大多数规则引擎被系统代码看作是一个黑盒子。 如果我要构建域模型,我可能希望某些业务规则是域模型的内在的,例如,当对象具有无效值时告诉我的业务规则。 这允许多个系统共享域模型而不重复业务逻辑。 我可以让每个系统使用相同的规则服务来验证我的域模型,但这似乎削弱了我的域模型(正如问题中指出的那样)。 为什么? 因为我始终在所有系统上始终执行我的业务规则,而是依靠系统程序员来确定业务规则何时被执行(通过调用规则服务)。 这可能不是一个问题,如果域模型来到你完全填充,但如果您正在处理一个用户界面或系统改变域模 ...
  • 以下是许多开源Java规则引擎的简要介绍 ,其中包括像Drools等常见的犯罪嫌疑人。 Here is a rundown of many open-source Java rules engines including the usual suspects like Drools, etc.
  • 您可以使用Google Cloud Datastore API (目前处于预览版)从计算引擎连接到数据存储区 目前,不支持像Objectify这样的App Engine Java客户端库,只支持基于protobuf的低级Java API:请参阅Java入门指南 。 我在公共问题跟踪器上创建了一个问题,因为这是工程团队有兴趣在将来支持的。 You can connect to the Datastore from Compute Engine using Google Cloud Datastore API ...
  • 基于PHP(云)应用程序的一种替代方法是PHP Fog 。 它也似乎有你需要的MySQL功能。 由于此服务本质上是云托管服务,因此您无需处理底层图层,因此它可以处理防火墙配置和类似要求。 I think the best solution that fit my criteria is Scalr . This is the ultimate PaaS solution out there. Auto mysql scaling, auto app scaling, you can create roles ...
  • 如果你确定你需要一个规则引擎,你需要找到一个可以在Ruby中使用的规则引擎。 谷歌的快速搜索带来了Rools(http://rools.rubyforge.org/)和Ruby Rules(http://xircles.codehaus.org/projects/ruby-rules)。 我不确定这两个项目的状态。 使用JRuby和Drools可能是你最好的选择,但话说回来,我是一名Java开发人员和Drools的大倡导者。 :) 在不了解所有细节的情况下,有点难以说明应如何实施。 它还取决于您希望如何更新 ...
  • 在一个已经SO脚步的库似乎工作,你可以使用具有更好性能的php-gettext-memcached ! They still do not support the gettext extension (now June 2016, issue started October 2014), so in the end I resorted to using this gettext library, which works just fine. I used the following code to che ...
  • 经过几周的搜索,我会和Drools一起去。 看起来唯一可能的选项可以满足项目的需求https://www.drools.org/ After few weeks of search , i will go with Drools. Looks like the only possible option can fit the needs for the project https://www.drools.org/
  • 这与PHP的想法相同: 第一步:PHP源代码(即一些文本)被编译为一组操作码 第二步:这些操作码被执行。 默认情况下,每次执行PHP脚本时都会执行此编译 - 这需要一些CPU。 这就是为什么您可以使用某些操作码缓存(如APC扩展 )将操作码存储在内存中的原因 - 避免冗余编译步骤。 在Sebastian Bergmann的以下演示中,您将能够找到关于这些过程的一些有趣信息: PHP Compiler Internals It's kind of the same idea with PHP : First ...
  • 如果您100%确定不需要任何后端逻辑,并且永远不会,请参阅在Android中使用Google Cloud Storage JSON api进行直接Android < - > Google云端存储操作。 通常,在应用程序成功的过程中,最终需要后端的一些逻辑(例如,处理不同版本的客户端 - 并非所有更新都在同一纳秒:-),因此通常更谨慎和未来 - 使前端可以访问App Engine后端,除了提供对云存储的访问权限之外,还可以应用所需的任何逻辑。 在版本0.1,所需的逻辑量可能非常小(尽管通常至少是某种类型的身份 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。