Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate vs EclipseLink

I'm starting a new Web project and I've chosen JPA as my persistence ORM engine.

Although I've used OpenJPA in my last project, now I want to use EclipseLink.

Why? It is the JPA reference implementation, it has a lot of documentation and a very good support in the Eclipse IDE. Also, I can't found any benchmark that declares none of them to be the best, so performance is not a factor (all implementations has its own strength points).

But, I want to use the JSR-303 validation spec, and I've chosen hibernate-validator (witch is the reference implementation of the Bean Validation spec).

Moreover, I'm using Spring, and there are a lot of examples with Spring+Hibernate, but I haven't found any opinion that said Spring is better with Hibernate.

Is there any problem mixing this two implementations? Would be better to use Hibernate JPA with Hibernate Bean validation?

like image 341
jfcorugedo Avatar asked Oct 06 '13 21:10

jfcorugedo


People also ask

What is the difference between EclipseLink and Hibernate?

Hibernate is very popular implementation of JPA built by Red hat. It also has some extra features that JPA does not provide. Eclipse link jar file format − It is complete package. It has everything which need to run any Eclipse link functionality.

Is EclipseLink a JPA?

EclipseLink, built by the Eclipse Foundation, provides an open-sourced JPA implementation.

What is EclipseLink for?

EclipseLink is the open source Eclipse Persistence Services Project from the Eclipse Foundation. The software provides an extensible framework that allows Java developers to interact with various data services, including databases, web services, Object XML mapping (OXM), and enterprise information systems (EIS).


1 Answers

I have been using EclipseLink implementation of JPA with Spring and Hibernate-validation-4.2.0.Final. And no problem so far. Now to answer your question:

Is there any problem mixing this two implementations?

I don't think there will be any problem using EclipseLink JPA implementation with Hibernate implementation for JSR-303 validation spec together, as the purpose of these two specifications are different:

  • JSR 303 - Bean Validation - defines a metadata model and API for entity validation. This is not tied to a specific application tier or programming model.
  • JPA - This is the specification of the Java API for the management of persistence and object/relational mapping with Java EE and Java SE.

Spring provides full support for the JSR-303 Bean Validation API. You just need to have a JSR-303 provider, such as Hibernate Validator, present in the classpath and will be detected automatically.

And the Spring JPA, available under the org.springframework.orm.jpa package, offers comprehensive support for the Java Persistence API in a similar manner to the integration with Hibernate.

like image 101
Debojit Saikia Avatar answered Oct 02 '22 23:10

Debojit Saikia