Вопрос

I am a junior programmer and was asked to develop an application that should utilize the Java Persistence API (JPA).

Which is the most popular JPA implementation (Hibernate, Toplink, EclipseLink)

Can I use any of the above with Apache Tomcat or every implementation is tied to a specific server application ?

Are there any good introductory books or tutorials for this subject ?

Это было полезно?

Решение

That depends. Both solutions work but each has made their own design decisions and depending on you, those might work in your favor or against it.

So I suggest to implement a simple but complete prototype using both technologies (spend a week with each) to learn which one suits you better. Complete means: Implement each use case that you know you'll need, especially a complicated one.

As a guideline, I've found that Hibernate has more features but Eclipse Link gives you better error messages -> I spent less time fixing problems with Link.

On the other hand, Hibernate has more features built in, so I spent less time there to turn requirements into code - when I could find the feature, understand how it works and I didn't run into some odd error message that just left me stumped and running in circles for a couple of days.

Eclipse Link was once a commercial product, so the documentation is better.

Другие советы

If you choose Toplink, you will be fired and spend your days under a bridge drinking cheap vodka, wondering what your career could have been like.

I hear nothing but good about EclipseLink, but I think Hibernate has more industry usage and has some non-JPA features.

You should be able to use them all with Tomcat as they're an implementation of a Java API rather than relying on any container in particular.

This is a very subjective question.
I think Hibernate is still more popular, but the most popular things must not always be the best for a specific task.

Personally, I would go with EclipseLink (which is the successor of TopLink) in most projects - it's not for nothing the reference implementation of JPA with a good support and regular releases, driven by the Eclipse Foundation and coming with a good documentation.

You can use both EclipseLink and hibernate with every application server (tomcat is perfectly fine) and even stand-alone (without an application server at all) - the JPA standard guarantees that.

If you do not use implementation-specific things (and stick to JPA), you can even exchange EclipseLink with Hibernate (and vice versa) - although I would only do that for very good reasons.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top