开发者

When to use Hibernate?

I was asked in an interview this question so I answered with the following:

-Better Performance: - Efficient queries. - 1st and 2nd level caching. - Good caching gives better scalability. - Good Database Portability: - Changing the DB is as easy as changing the dialect configuration. - Increased Developer Productivity: - Think only in object term开发者_如何学运维s not in query language terms.

But I also feel that systems fall in one of the below categories, and Hibernate may not be suited for all these cases, I'm interested in your thoughts about this, do you agree with me? please let me know when would use HB in the following case and why.

  • Write Only Systems:
  • Read Only Systems:
  • Write Mostly Systems:
  • Read Mostly Systems:

Regards Ramo


Hibernate is suitable for most of the applications where you have an object oriented model. So you could ask: when is an object oriented model appropriate?

I would say, the biggest advantage is the developer productivity. Query performance by itself is usually worse then hand-coded queries, because it can't optimize for each particular case. Hibernate compensates this very well by the use of caches.

Write only (and mostly) systems can't take much advantage from the caches, it could even decrease performance a lot (you should avoid using the cache). These kind of systems usually do not need an object oriented model, they just push data into the data base.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜