首页 \ 问答 \ hibernate中的条件saveOrUpdate(Conditional saveOrUpdate in hibernate)

hibernate中的条件saveOrUpdate(Conditional saveOrUpdate in hibernate)

我有一个具有日期属性的映射类。 我想saveOrUpdate这个类的对象,以便只有比存储的更旧时才更新已存在的对象。

我该怎么做(尽可能整齐有效)?

我有很多这样的课程,所以我希望避免为所有这些课程编写大量的自定义HQL。


I have a mapped class that has a date property. I would like to saveOrUpdate objects of this class so that already existing is updated only if it is older than the stored one.

How would I do that (neatly and efficiently if possible)?

I have a lot of classes like this so I would hope to avoid writing tons of custom HQL for all of them.


原文:https://stackoverflow.com/questions/10121236
更新时间:2022-10-19 20:10

最满意答案

如果您使用matplotlib只是为了使用默认字体等显示某些图表,您可以在dist/mpl-data文件夹中删除除matplotlib.conf和matplotlibrc以外的所有文件夹。

我这样做了,在12MB上节省了4MB。

为什么你的dist是43.5MB可能不是全部由于matplotlib ......


If you're using matplotlib just to show some chart using default font etc you can just delete in dist/mpl-data folder all but matplotlib.conf and matplotlibrc.

I did this and saved up abot 4MB on 12MB.

Why your dist is 43.5MB probably is not all due to matplotlib...

相关问答

更多
  • 解决了: 因此,使用快速手指(并使用带有--debug选项的PyInstaller编译它),我对包含Traceback的快速关闭控制台窗口进行了屏幕截图: WindowsError: [Error 3] The system cannot find the path specified: 'C:\\path\\dateutil\\zoneinfo/*.*' zoneinfo文件保存在pytz而不是dateutil中。 快速重命名解决了这个问题。 但只是问题,如果你想用-F或--onefile进行编译,由于最 ...
  • 有时我发现py2exe无法包含软件包,即使在packages选项中列出,但是我发现如果我在setup.py中导入软件包它会开始工作,所以尝试添加,靠近setup.py的顶部: import assimulo 你有时会发现它 if False: import assimulo 会工作,(使用这是assimulo在导入时做了很多设置)。 The solution to my problem was obtained by adding, in the includes option, the alg ...
  • 您应该明确包含matplotlib模块。 如果你这样做,你可以从不可用的dll中获得一些错误,那么你应该排除它们。 一个适用于我的文件的设置: from distutils.core import setup import py2exe import matplotlib setup(console=['afile.py'], options={ 'py2exe': { 'packages' : ['matpl ...
  • 从你的编辑看来,问题似乎与访问一些打包的插件(而不是yapsy模块本身)有关。 为此,您可能需要检查以下两点: 当你调用self.manager.setPluginPlaces(["plugins"])注意路径“plugin”可能与您认为的目录无关。 您应该使用更具体的路径,使用py2exe的“where Am I”常见问题解答提示: http ://www.py2exe.org/index.cgi/WhereAmI 您也可以尝试将插件打包为data_files(就像您链接到的网页一样),我不确定py2ex ...
  • 您的问题是您正在尝试使用IDLE编译脚本。 当你使用py2exe ,你必须做一点点不同。 如果你之前使用过Disutils,你可能已经看过: python setup.py install 与使用py2exe的方式相同。 所以输入cmd: python untitled-22.py py2exe 它应该工作。 顺便说一句,我建议你在py2exe.org上阅读本教程。 Your problem is that you are trying to compile your script using IDL ...
  • 这不是一个错误,它只是一个关于被弃用的类的警告; 在这种情况下,不推荐使用sets模块,新代码现在应该使用内置的set类。 Its not an error, its just a warning about a deprecated class; in this case the sets module is deprecated and the new code should use built-in set class now.
  • 我找到了更好的解决方案....使用Pyinstaller帮助我轻松地将.py转换为.exe .... I found a better solution....Using Pyinstaller helped me converting the .py to .exe easily....
  • 那么它不会失败吗? 您希望msvcr71.dll与exe在同一目录中,以便库加载器能够找到并将其链接到应用程序的内存映射中。 它是基本操作所必需的,所以你不能让py2exe用其余的DLL解压缩它。 Wouldn't it fail to launch, then? You want msvcr71.dll in the same directory as the exe, so that the library loader will be able to find and link it into the ...
  • 如果您使用matplotlib只是为了使用默认字体等显示某些图表,您可以在dist/mpl-data文件夹中删除除matplotlib.conf和matplotlibrc以外的所有文件夹。 我这样做了,在12MB上节省了4MB。 为什么你的dist是43.5MB可能不是全部由于matplotlib ...... If you're using matplotlib just to show some chart using default font etc you can just delete in di ...
  • 我通过稍微修改用于创建可执行文件的setup.py文件来解决: from distutils.core import setup import py2exe # We need to import the glob module to search for all files. import glob # We need to exclude matplotlib backends not being used by this executable. You may find # that you ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)