Announcement Announcement Module
Collapse
No announcement yet.
Hibernate4 hbm.xml Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate4 hbm.xml

    Hi,

    I am trying to migrate to hibernate4/spring 3.1.0.RC1.

    It seems org.springframework.orm.hibernate4.LocalSessionFac toryBean does not really work the same as org.springframework.orm.hibernate3.LocalSessionFac toryBean. The issue is we are using xml to configure the entities. We require functionality of Hibernate search 4.0 so require hibernate core 4.0 but still need to keep the hibernate xml file annotation.

    Is there another way to configure org.springframework.orm.hibernate4.HibernateTransa ctionManager with out using annotations for hibernate?


    Thanks,
    Greg B.

  • #2
    just to add to this the error I am getting is:

    java.lang.NullPointerException
    at org.springframework.orm.hibernate4.LocalSessionFac toryBuilder.scanPackages(LocalSessionFactoryBuilde r.java:138)

    and my config is:


    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate4.LocalSes sionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="mappingLocations">
    <list>
    <value>classpath:my/domain/Article.hbm.xml</value>
    <value>classpath:my/domain/Gallery.hbm.xml</value>
    <value>classpath:my/domain/Model.hbm.xml</value>
    <value>classpath:my/domain/Video.hbm.xml</value>
    <value>classpath:my/domain/Tag.hbm.xml</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">${hibernate.dialect}</prop>
    <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
    <prop key="hibernate.search.model_mapping">my.infrastruc ture.hibernate.search.ProgrammaticSearhMappingFact ory</prop>
    <prop key="hibernate.search.default.directory_provider"> filesystem</prop>
    <prop key="hibernate.search.default.indexBase" >C:\Program Files\apache\apache-tomcat-7.0.21\lucene</prop>
    </props>
    </property>
    <property name=""></property>
    </bean>


    <tx:annotation-driven />
    <bean id="transactionManager"
    class="org.springframework.orm.hibernate4.Hibernat eTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    Comment


    • #3
      Add one line - <property name="packagesToScan" value="com" /> , like below -

      <property name="hibernateProperties">
      <props>
      <prop key="hibernate.dialect">${hibernate.dialect}</prop>
      <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
      <prop key="hibernate.search.model_mapping">my.infrastruc ture.hibernate.search.ProgrammaticSearhMappingFact ory</prop>
      <prop key="hibernate.search.default.directory_provider"> filesystem</prop>
      <prop key="hibernate.search.default.indexBase" >C:\Program Files\apache\apache-tomcat-7.0.21\lucene</prop>
      </props>
      </property>
      <property name="packagesToScan" value="com" />

      Comment

      Working...
      X