Results 1 to 3 of 3

Thread: To use Hibernate annotation mapping with ...

  1. #1

    Default To use Hibernate annotation mapping with ...

    I need to add a new functionality to an existing Spring-Hibernate web application. I would like to use the annotation mapping this time. I don't know how to make this happen. In the old way, to build a Hibernate SessionFactory and makes it available as bean reference.I have the following in the applicationContent-hibernate.xml file:

    Code:
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    To use annotation, I believe that I need to have the following instead:
    Code:
    <bean id="sessionFactory"  class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    Do I need to have two session factories? Or, one can work with the other?

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

    Default

    You only need 1... Use the annotation based one it can also work with mapping files if i'm not mistaken.
    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

    Default

    Quote Originally Posted by Marten Deinum View Post
    You only need 1... Use the annotation based one it can also work with mapping files if i'm not mistaken.
    Thanks Marten. I will get it a try.

    According to the Spring document (http://static.springframework.org/sp...ctoryBean.html), org.springframework.orm.hibernate3.annotation.Anno tationSessionFactoryBean is a subclass of org.springframework.orm.hibernate3.LocalSessionFac toryBean. It should work.

Posting Permissions

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