2011-02-15 53 views
1

我相信這是一個相當簡單的問題,但我似乎無法用谷歌可以幫助它的措辭。初學者休眠/春/ hiberante搜索問題(配置)

在hibernate-search文檔中有一個編程API(http://docs.jboss.org/hibernate/search/3.2/reference/en-US/html/search-mapping.html#hsearch-mapping-我試圖創建一個搜索映射,如下所示: 代碼: SearchMapping mapping = new SearchMapping(); [...] configuration.setProperty(Environment.MODEL_MAPPING,mapping);

但我真的不明白什麼是配置對象,我將如何獲得它。我爲我的DAO使用spring和org.springframework.orm.hibernate3.support.HibernateDaoSupport軟件包,所以我需要以某種方式注入bean的形式?我會在春季論壇上發佈這個消息,以及它可能與春季更相關。

任何幫助和建議將不勝感激。

春天設置在這裏是它是有用的,如果其他代碼將有助於只是讓我知道 代碼:如果你想使用Spring的AnnotationSessionFactoryBean時候來定製Configuration

 <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> 

回答