解决方案 »

  1.   

    hibernate search + spring的例子,有吗?
    不是hibernate+spring
      

  2.   

    只需要在spring中这样配置就OK了。
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref local="dataSource" />
    </property>
    <property name="configLocation">
    <value>classpath:hibernate.cfg.xml</value>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.jdbc.fetch_size">50</prop>
    <prop key="hibernate.jdbc.batch_size">50</prop>
    <prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</prop>
    <prop key="hibernate.search.default.indexBase">D:\\cached\\website\\ad\\test</prop>
    <prop key="hibernate.search.default.transaction.merge_factor">100</prop>
    <prop key="hibernate.search.default.transaction.max_buffered_docs">100</prop>
    <prop key="hibernate.search.autoregister_listeners">true</prop>
    <prop key="hibernate.search.indexing_strategy">manual</prop>
    </props>
    </property>
    </bean>
      

  3.   

    事务配置实例:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
    <!--定义数据源-->
    <bean id="mysql"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName"
    value="com.mysql.jdbc.Driver">
    </property>
    <property name="url" value="jdbc:mysql://localhost:3306/test"> </property>
    <property name="username" value="root"> </property>
    <property name="password" value="1"> </property>
    </bean> 
    <!--spring注入hibernate的sessionFactory-->
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="mysql" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.MySQLDialect
    </prop>
    <prop key="hibernate.show_sql">true </prop>
    </props>
    </property>
    <property name="mappingResources">
    <list>
    <value>dao/myEntity.hbm.xml </value>
    </list>
    </property>
    </bean> 
    <!--声明事务-->
    <bean id="transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>
    <tx:advice id="txAdvice">
    <!-- the transactional semantics... -->
    <tx:attributes>
    <!-- all methods starting with 'get' are read-only -->
    <tx:method name="insert*" propagation="REQUIRED"/>
    <tx:method name="save*"  propagation="REQUIRED"/>
    <tx:method name="*" propagation="REQUIRED" read-only="true" />
    </tx:attributes>
    </tx:advice>
    <aop:config>
    <aop:pointcut id="fooServiceOperation"
    expression="execution(* com.xxx.*.*(..))" />
    <aop:advisor advice-ref="txAdvice"
    pointcut-ref="fooServiceOperation" />
    </aop:config> <bean id="xxxService" class="com.xxx.XxxService">
    <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>

    </beans>
      

  4.   

    http://i.mop.com/qldd_2001/blog/2007/07/15/1938678.html
      

  5.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【liu_shui8】截止到2008-07-10 15:05:17的历史汇总数据(不包括此帖):
    发帖的总数量:2                        发帖的总分数:200                      每贴平均分数:100                      
    回帖的总数量:54                       得分贴总数量:13                       回帖的得分率:24%                      
    结贴的总数量:2                        结贴的总分数:200                      
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:0                        未结的总分数:0                        
    结贴的百分比:100.00%               结分的百分比:100.00%                  
    无满意结贴率:0.00  %               无满意结分率:0.00  %                  
    敬礼!
      

  6.   


    这个哪里有hibernate search?
      

  7.   

    其实也就是把以前的查询拿luncene再来一次而已.很简单,多看看文档,也可以参考一下FaceYe
    ******************************************************************
    关于FaceYe开源portal的其它更多内容包括:
    [list]
    [*]FaceYe开源介绍总站(含FaceYe小组联系方式)http://ecsun.javaeye.com
    [*]FaceYe开源运行预览图http://ecsun.javaeye.com/album
    [*]FaceYe开源最新下载http://faceye.googlecode.com
    [*]FaceYe开源基础版(开源)介绍(总述)http://ecsun.javaeye.com/blog/205750
    [*]FaceYe开源(基础版)中对JavaScript的动态加载 http://ecsun.javaeye.com/blog/210441
    [*]FaceYe开源(基础版)中对带复选框的树结构的处理 http://ecsun.javaeye.com/blog/205911
    [*]FaceYe开源(基础版)中对JSON数据的处理.http://ecsun.javaeye.com/blog/205882
    [*]FaceYe开源(基础版)安全框架总述(acegi功能加强版)http://ecsun.javaeye.com/blog/212877
    [*]FaceYe开源(基础版)FaceYe开源基于HibernateTools生成DAO/Entity/HBM/DBhttp://ecsun.javaeye.com/blog/213477
    [/list]
    FaceYe用户及开发人员提供文档(以下内容为FaceYe开发人员或用户提供,请尊重原著):
    [list]
    [*]FaceYe部署及相关问题解决http://code.google.com/p/faceye/wiki/deployFaceyeProject
    [/list]
    ******************************************************************