初学者休眠/弹簧/休眠搜索问题(配置)

时间:2011-02-15 11:50:37

标签: java hibernate spring hibernate-search

我确信这是一个相当简单的问题,但我似乎无法用谷歌可以帮助的方式来表达它。

在hibernate-search文档中有一个编程API(http://docs.jboss.org/hibernate/search/3.2/reference/en-US/html/search-mapping.html#hsearch-mapping-programmaticapi ),

我正在尝试按照以下方式创建搜索映射: 码: SearchMapping mapping = new SearchMapping(); [...] configuration.setProperty(Environment.MODEL_MAPPING,mapping);

但我真的不明白配置对象是什么以及我将如何获得它。我正在为我的DAO使用spring和org.springframework.orm.hibernate3.support.HibernateDaoSupport包,所以我需要以bean的形式注入某种东西吗?我会在一个春季论坛上播放它,以及它可能与春天有关。

非常感谢任何帮助和建议。

Spring安装在这里是有用的,如果其他代码可以帮助我告诉我 码:           

     <property name="annotatedClasses">
        <list>

          <value>com.ActivityGB.client.domain.Provider</value>
          <value>com.ActivityGB.client.domain.Activity</value>
          <value>com.ActivityGB.client.domain.Location</value>
          <value>com.ActivityGB.client.domain.Address</value>
          <value>com.ActivityGB.client.domain.Category</value>
        </list>

   </property>

  <property name="mappingResources">

     <list>

        <value>com/ActivityGB/client/domain/Provider.hbm.xml</value>
        ....
        <value>com/ActivityGB/client/domain/UserWall.hbm.xml</value>



     </list>
  </property>
  <property name="hibernateProperties">
     <props>
        <prop key="hibernate.bytecode.provider">cglib</prop>
        <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
        <prop key="hibernate.show_sql">true</prop>
        <prop key="hibernate.format_sql">true</prop>
        <!-- <prop key="hibernate.use_sql_comments">true</prop> -->
        <prop key="hibernate.bytecode.use_reflection_optimizer">true</prop>
        <prop key="hibernate.jdbc.batch_size">20</prop>

        <prop key="hibernate.c3p0.min_size">10</prop>
        <prop key="hibernate.c3p0.max_size">100</prop>
        <prop key="hibernate.c3p0.timeout">10</prop>
        <prop key="hibernate.c3p0.acquireRetryAttempts">30</prop>

        <prop key="hibernate.c3p0.acquireIncrement">5</prop>

        <prop key="hibernate.c3p0.idleConnectionTestPeriod">100</prop>

        <prop key="hibernate.c3p0.initialPoolSize">20</prop>
        <prop key="hibernate.c3p0.maxPoolSize">100</prop>
        <prop key="hibernate.c3p0.maxIdleTime">300</prop>
        <prop key="hibernate.c3p0.maxStatements">50</prop>
        <prop key="hibernate.c3p0.minPoolSize">10</prop>

        <prop key="hibernate.c3p0.preferredTestQuery">SELECT 1</prop>


        <prop key="hibernate.c3p0.testConnectionOnCheckout">true</prop>
        <prop key="show_sql">true</prop>

        <prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</prop>

        <prop key="hibernate.search.default.indexBase">d:\luceneFinal\</prop>
     </props>
  </property>

1 个答案:

答案 0 :(得分:2)

如果您想在使用Spring Configuration时自定义AnnotationSessionFactoryBean,则可以对其进行子类化并覆盖postProcessConfiguration()