Results 1 to 4 of 4

Thread: EntityManager versus getHibernateTemplate()?

  1. #1
    Join Date
    May 2009
    Posts
    5

    Default EntityManager versus getHibernateTemplate()?

    Hi

    Which one we should use, entity manager or hibernate template in spring?
    from the design perspective which one is better.


    Thanks
    ved

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    You are comparing apples and oranges. You should either compare the SessionFactory and HibernateTemplate or EntityManager and JpaTemplate. I suggest you read this.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    May 2009
    Posts
    5

    Default

    Thanks Marten for the reply.

    I was my bad that i didnot explain the question properly. I went through the blog and must say it was very informative.

    Basically i wanted to know, from the design and approach perspective, as to whether to use Hibernate session or the JPA entitymanager api's when you are starting a new project.

    My take would be to use Entitymanager for the very simple and basic fact that one should always use and follow the specification api's (JPA) rather then using then using the implementation of the specs i.e Hibernate session.

    Just wanted to know the views of experts out there.

    Thanks
    Ved

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    There is no real design decision here (with JPA or hibernate 3.0.1 or higher) before that your code would be scattered with

    a) Error handling code
    b) transaction management code

    The HibernateTemplate/JpaTemplate made that easier, however as the blog explained there is no need for that anymore...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •