slatorFactory与ASTQueryTranslator

slatorFactory与ASTQueryTranslator

本文介绍了休眠。 ClassicQueryTranslatorFactory与ASTQueryTranslatorFactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这些查询翻译器之间有什么区别(我的意思是我作为Hibernate用户的差异)。互联网上的一些博客表示,基于ANTLR的翻译器速度更快。但我认为,如果其中一个显然更好,那么Hibernate开发人员将删除另一个。所以......有什么区别,为什么我们有他们两个呢?我应该在什么情况下选择第一或第二?在什么情况下,我不应该选择一位翻译员?

内部休眠配置 ;它在升级到版本3时得以实施。除非有很强的理由,否则不应该担心要更改它。此外,对于最新版本,我认为您需要更改其默认值。但如果你想要的话,你可以测试它的性能改善,如下所示。



和一个有关此问题的博客。



现在回答您的问题;

正如变更记录中所述,hibernate 3将 ClassicQueryTranslatorFactory 替换为 ASTQueryTranslatorFactory 。这是一个内部变化,用户不需要记住它,直到变化破坏你的应用程序。

默认情况下 ASTQueryTranslatorFactory 已启用,只有在升级到版本3时任何查询中断的情况下,才应考虑更改它。



再次说明过去的故事2006左右);最新版本的hibernate是4.1,查询翻译器现在必须稳定。所以99%你不必改变任何东西。

What's the difference between those query translators (I mean differences for me as a Hibernate user). Some blogs on the internet say that ANTLR-based translator is faster. But I deem that if one of them was clearly better, then Hibernate developers would remove the other one. So.. what's the difference and why do we have both of them? In what situations should I choose first or second? In what situations I shouldn't choose one of translators?

解决方案

It is an internal hibernate configuration; which got implemented when it got upgraded to version 3. You should not be worried about changing it until unless there is any strong reason for it. Also with the latest versions I think you need to change its default value. But if you want you can test it for performance improvement as told below.

From the Hibernate Core Migration Guide : 3.0;

Here is Forum post and a blog post regarding this issue.

Now coming to your questions;

As told in the change log, hibernate 3 replaces the ClassicQueryTranslatorFactory with ASTQueryTranslatorFactory. It is an internal change and the users need not be wooried about it until the change breaks your application.

By default ASTQueryTranslatorFactory is enabled, you should consider changing it only if any of your queries break while upgrading to version 3.

Once again, it a story of the past(2006 or so); the latest version of hibernate is 4.1 and the query translator must be stable by now. So 99% you do not have to change any thing.

这篇关于休眠。 ClassicQueryTranslatorFactory与ASTQueryTranslatorFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 04:32