Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate - beyond Object/Relational Mapping?

Tags:

orm

hibernate

Looking at http://www.hibernate.org/ it has this introduction text:

Historically, Hibernate facilitated the storage and retrieval of Java domain objects via Object/Relational Mapping. Today, Hibernate is a collection of related projects enabling developers to utilize POJO-style domain models in their applications in ways extending well beyond Object/Relational Mapping.

In other words: originally it was about ORM, now it's about more than ORM.

Reading between the lines: ORM isn't the only game in town - there are newer ways of approaching these things that may work better.

When I go into the documentation, it still just describes it as an ORM library. Are there any good blog posts that give an overview of specifically any new "post-ORM" approaches that have been taken, and how those features work and are intended to be used (and how/why they might be better than "traditional" ORM)?

like image 971
Daniel Earwicker Avatar asked Mar 23 '11 15:03

Daniel Earwicker


2 Answers

It depends how you define and what you expect form an ORM tool. I think of ORM of a something that just does, er, object to db mapping and vice versa. Hibernate does a lot more, for example:

  • caching (objects/queries, first/second level)
  • lazy loading
  • ability to replicate object between two different datastores
  • declarative security
  • Criteria API
  • mapping between objects and XML
  • automatic schema generation

The list can probably go on an on (if you're not convinced yet, add Spring integration on top). If one would be asked yourself ten years ago, none would name these features being be part of a casual ORM library.

We are so used to Hibernate now that people stopped noticing it become a feature creep very rich framework. Obviously most of those features come with a price, but you can always choose not to pay and stick with basic ORM.

like image 125
mindas Avatar answered Oct 27 '22 05:10

mindas


Reading between the lines: ORM isn't the only game in town - there are newer ways of approaching these things that may work better.

Reading literally: they talk about "related projects" that provide additional features, namely:

  • Hibernate Validator - declarative validation of POJOs
  • Envers - transparent auditing and versioning
  • Hibernate Search - full text search integration
like image 22
axtavt Avatar answered Oct 27 '22 05:10

axtavt