java Hibernate 比 NHibernate 差吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/947367/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 14:31:17  来源:igfitidea点击:

Is Hibernate worse than NHibernate?

java.netnhibernatehibernateorm

提问by ripper234

How does Hibernate compare to NHibernate?

Hibernate 与 NHibernate 相比如何?

I've heard the claim that "Hibernate is much worse than NHibernate, even to the point of not using it (and using JDBC over it)". Can anyone support or refute this?

我听说过“Hibernate 比 NHibernate 差得多,甚至到了不使用它(并在它上面使用 JDBC)”的说法。任何人都可以支持或反驳这一点吗?

Update- I am nottrying to decide between them. Our DAL team decided to use NHibernate for our .Net side, but not use Hibernate on the java side because "it is not good enough". Me being a newb to ORM, I'm trying to understand what are the differences.

更新- 我不想在它们之间做出决定。我们的 DAL 团队决定在我们的 .Net 端使用 NHibernate,但不在 java 端使用 Hibernate,因为“它不够好”。我是 ORM 的新手,我试图了解有什么区别。

Specifically, we are using Fluent NHibernate.

具体来说,我们正在使用 Fluent NHibernate。

回答by kgiannakakis

This claim is ridiculous. Hibernate was originally designed for Java and then ported to .NET. Hibernate is the most prominent ORM tool in Java today and it is highly acclaimed by developers. It is also an awardwinning framework.

这种说法是荒谬的。Hibernate 最初是为 Java 设计的,然后移植到 .NET。Hibernate 是当今 Java 中最著名的 ORM 工具,受到开发人员的高度评价。它也是一个屡获殊荣的框架。

回答by Peter

NHibernate is a port of hibernate which is java over to .Net,

NHibernate 是 hibernate 的一个端口,它是 java 到 .Net,

Currently NHibernate is only a subset of Hibernate but it is quickly catching up.

目前 NHibernate 只是 Hibernate 的一个子集,但它正在迅速赶上。

I think the two are comparable for the most part it's only the more advanced features which are different.

我认为这两者在很大程度上是可比的,只是更高级的功能有所不同。

NHibernate has things like Linq based configuration which I don't think hibernate has an equivalent.

NHibernate 有类似基于 Linq 的配置,我认为 hibernate 没有类似的配置。

Ayende Rahien is probably the best person to answer this question he was one of the principal members of the nhibernate team. His blog is here

Ayende Rahien 可能是回答这个问题的最佳人选,他是 nhibernate 团队的主要成员之一。他的博客在这里

回答by DaveMorganTexas

The power and elegance of LINQ must count for some added ability to create complex queries from simpler expressions. This portion of the nhibernate interface alone makes it an evolutionary leap beyond hibernate.

LINQ 的强大和优雅必须考虑到一些从更简单的表达式创建复杂查询的附加能力。仅 nhibernate 界面的这一部分就使其超越了 hibernate。

Refer to: What is the Java equivalent for LINQ?

请参阅:LINQ 的 Java 等价物是什么?

回答by toolkit

I would seriously question this comment.

我会严重质疑这个评论。

Granted, Hibernate has a wealth of features, that require some investigation to understand fully. I would suggest that whoever made this comment has not read Java Persistence with Hibernate, which is a great reference.

诚然,Hibernate 具有丰富的功能,需要进行一些调查才能完全理解。我建议发表此评论的人没有阅读Java Persistence with Hibernate,这是一个很好的参考。

It's also interesting to note that Grailsuses Hibernate under the covers.

有趣的是,Grails幕后使用 Hibernate。

回答by Hardwareguy

If you're like me and don't like the way Hibernate does business, you might try using iBatis. http://ibatis.apache.org/

如果你和我一样不喜欢 Hibernate 做生意的方式,你可以尝试使用 iBatis。 http://ibatis.apache.org/

回答by matt b

Always be dubious of claims that "A is worse than B" that aren't backed up by numbers and/or evidence.

始终怀疑没有数字和/或证据支持的“A 比 B 更糟”的说法。