开发者

Newbie question on Hibernate... in context of Martin Fowler article

In Domain Logic and SQL, Martin Fowler talks about 3 styles of interfacing with a database:

  1. Transaction Script
  2. Domain Model, and
  3. Logic in SQL

What I'd like to know is:

  1. When employing Hibernate for persistence, which of the above 3 styles is typically used and/or encouraged?
  2. Is there any 4th style when using开发者_运维知识库 Hibernate?

(In context of Hibernate, substitute HQL in place of SQL above.)

Many thanks...


Usually, you use O/R mappers like Hibernate with a domain model.


EDIT:

Yes, that would be #2, Domain Model.
Actually, I don't know much about Hibernate, I only work with NHibernate (the .net port of Hibernate). But as it's a port of Hibernate, the basics should be about the same.
Hibernate and NHibernate probably do their share of internal voodoo to increase performance, but I don't know enough about their internals to elaborate on details.

You should also take into consideration that the Fowler article was last updated in February 2003 (7.5 years ago!), and that mature O/R mappers like (N)Hibernate probably have increased their performance since then.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜