Announcement Announcement Module
Collapse
No announcement yet.
Spring+JPA, Hibernate+JPA, Spring+Hibernate+JPA ?? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring+JPA, Hibernate+JPA, Spring+Hibernate+JPA ??

    I'd recently picked up on Spring and was recommending our team to use Spring + Hibernate stack. Now I ran into some articles on JPA. I went through some examples with Spring's JPA support. Now here are my questions,

    1) Do I need to use an ORM framework (like Hibernate) if I am going to use Spring + JPA ?
    2) What benefits do Spring+JPA provides over Spring+Hibernate?
    3) Is Spring+JPA an alternative to Spring+Hibernate? Does it provides all the features (abstraction, caching, distribution etc.) that Hibernate gives you?
    4) Can I continue to use Spring+Hibernate with these new APIs ?

    It's all very confusing to me right now - when do I use JPA or whether I should even need to care about it right now?

    Thanks.

  • #2
    JPA is a specification rather than a product. A number of ORM products, including Hibernate and TopLink, provide a JPA implementation. Thus, you can use Hibernate (for example) by either using it's own API or the JPA API. So, in theory, if you code against the JPA API you should be able to swap out implementations with no effect on your code.

    Note that currently the JPA specification does not cover all the features of the mature ORM implementations. For example, there is not criteria API under JPA. So, if you need any of these features you may have to use the implementation's native API.

    I don't think Spring enters into this in any way, it supports all the approaches equally as well for what it provides (eg declarative transactions).

    hope that helps.
    Jonny

    Originally posted by vivash
    I'd recently picked up on Spring and was recommending our team to use Spring + Hibernate stack. Now I ran into some articles on JPA. I went through some examples with Spring's JPA support. Now here are my questions,

    1) Do I need to use an ORM framework (like Hibernate) if I am going to use Spring + JPA ?
    2) What benefits do Spring+JPA provides over Spring+Hibernate?
    3) Is Spring+JPA an alternative to Spring+Hibernate? Does it provides all the features (abstraction, caching, distribution etc.) that Hibernate gives you?
    4) Can I continue to use Spring+Hibernate with these new APIs ?

    It's all very confusing to me right now - when do I use JPA or whether I should even need to care about it right now?

    Thanks.

    Comment


    • #3
      Spring+JPA using hibernate

      Hello,
      I too, would like to use Hibernate 3.2 as a JPA provider (and hence use Spring2 with JPA support), but I'm unable to understand which kind of configuration I have to provide to Spring, can someone help?

      Thanks,
      Alex

      Comment


      • #4
        Originally posted by jwray
        Note that currently the JPA specification does not cover all the features of the mature ORM implementations. For example, there is not criteria API under JPA. So, if you need any of these features you may have to use the implementation's native API.
        Very true!
        And do not forget about implementation extensions the kind Hibernate JPA solution provides. I personally love their domain object validators.
        @Pattern(regex="regexp", flag=false) rocks big time!

        Comment


        • #5
          Can anyone shed any more light on this subject? I am trying to investigate the same issue.

          I would like to know what are the differences in functionality (APIs) are between Native Hibernate and Hibernates implementation of JPA.

          Also, are there any performance differences? I assume not since the Hibernate JPA is a wrapper to the Hibernate Core.

          Thanks
          Marc

          Comment


          • #6
            I'm only just starting to look into JPA but so far it's pretty much Hibernate (there are obviously differences). I guess a quick look at Session and EntityManager might be useful. As for the Hibernate JPA, I'm not sure about any performance difference. I guess you'd have to profile it.

            Comment

            Working...
            X