知道美河 | 上传资料 | VIP申请 | 精品课程 | 资料搜索 | 问题反馈 | 会员手册 | 积分消费 | 积分充值 | 帐号保护
美河学习学习在线赞助VIP

美河学习在线(主站) eimhe.com

 找回密码
 建立账号
查看: 5946|回复: 2

[求助] 有几个问题欢迎各位来讨论

[复制链接]
发表于 2007-5-6 15:33:38 | 显示全部楼层 |阅读模式
1.有这样一个需求:
有一些文件比如.txt,.ppt,pdf这样一些文件。我是把他们放在数据库里还是一个固定目录。
还有怎么能够搜索他们呢?
2.Spring hibernate有什么好的机制可以提高效率吗(配置文件中能不能实现)

3.有多个dao它们对应多个service这些service要在spring文件中配置都使用声明式事物,有没有办法只注入一个基类的service其他的不用注入这样可以实现吗?
如以下的代码:<bean id="hibernateTemplate"
                class="org.springframework.orm.hibernate3.HibernateTemplate">
                <property name="sessionFactory"><ref bean="sessionFactory"/></property>
                <property name="jdbcExceptionTranslator">
                        <ref bean="jdbcExceptionTranslator"/>
                </property>
        </bean>

        <!-- Category DAO Definition: Hibernate implementation -->
        <bean id="categoryDao"
                class="cn.hxex.library.dao.hibernate.CategoryDaoHibernateImpl">
                <property name="hibernateTemplate">
                        <ref bean="hibernateTemplate"/>
                </property>
        </bean>

        <!-- Product DAO Definition: Hibernate implementation -->
        <bean id="productDao"
                class="cn.hxex.library.dao.hibernate.ProductDaoHibernateImpl">
                <property name="hibernateTemplate">
                        <ref bean="hibernateTemplate"/>
                </property>
        </bean>

        <!-- Record DAO Definition: Hibernate implementation -->
        <bean id="recordDao"
                class="cn.hxex.library.dao.hibernate.RecordDaoHibernateImpl">
                <property name="hibernateTemplate">
                        <ref bean="hibernateTemplate"/>
                </property>
        </bean>

        <!-- User DAO Definition: Hibernate implementation -->
        <bean id="userDao"
                class="cn.hxex.library.dao.hibernate.UserDaoHibernateImpl">
                <property name="hibernateTemplate">
                        <ref bean="hibernateTemplate"/>
                </property>
        </bean>
               
        <!-- ========================= Start of SERVICE DEFINITIONS ========================= -->  
       
        <!-- Hibernate Transaction Manager Definition -->
        <bean id="transactionManager"
                class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                <property name="sessionFactory">
                        <ref local="sessionFactory"/>
                </property>
        </bean>

        <!-- Cached Category Service Definition -->
        <bean id="categoryServiceTarget"
                class="cn.hxex.library.service.impl.CategoryServiceImpl">
                <property name="categoryDao">
                        <ref local="categoryDao"/>
                </property>
        </bean>
       
        <!-- Transactional proxy for the Category Service -->
        <bean id="categoryService"
                class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
                <property name="transactionManager">
                        <ref local="transactionManager"/>
                </property>
                <property name="target"><ref local="categoryServiceTarget"/></property>
                <property name="transactionAttributes">
                        <props>
                                <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
                                <prop key="save*">PROPAGATION_REQUIRED</prop>
                                <prop key="update*">PROPAGATION_REQUIRED</prop>
                                <prop key="delete*">PROPAGATION_REQUIRED</prop>
                        </props>
                </property>
        </bean>
       
        <!-- Cached Product Service Definition -->
        <bean id="productServiceTarget"
                class="cn.hxex.library.service.impl.ProductServiceImpl">
                <property name="productDao"><ref local="productDao"/></property>
        </bean>
       
        <!-- Transactional proxy for the Product Service -->
        <bean id="productService"
                class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
                <property name="transactionManager">
                        <ref local="transactionManager"/>
                </property>
                <property name="target"><ref local="productServiceTarget"/></property>
                <property name="transactionAttributes">
                        <props>
                                <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
                                <prop key="save*">PROPAGATION_REQUIRED</prop>
                                <prop key="update*">PROPAGATION_REQUIRED</prop>
                                <prop key="delete*">PROPAGATION_REQUIRED</prop>
                        </props>
                </property>
        </bean>
       
        <!-- Cached Record Service Definition -->
        <bean id="recordServiceTarget"
                class="cn.hxex.library.service.impl.RecordServiceImpl">
                <property name="recordDao"><ref local="recordDao"/></property>
        </bean>
       
        <!-- Transactional proxy for the Record Service -->
        <bean id="recordService"
                class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
                <property name="transactionManager">
                        <ref local="transactionManager"/>
                </property>
                <property name="target"><ref local="recordServiceTarget"/></property>
                <property name="transactionAttributes">
                        <props>
                                <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
                                <prop key="save*">PROPAGATION_REQUIRED</prop>
                                <prop key="update*">PROPAGATION_REQUIRED</prop>
                                <prop key="delete*">PROPAGATION_REQUIRED</prop>
                        </props>
                </property>
        </bean>
       
        <!-- Cached User Service Definition -->
        <bean id="userServiceTarget"
                class="cn.hxex.library.service.impl.UserServiceImpl">
                <property name="userDao"><ref local="userDao"/></property>
        </bean>
       
        <!-- Transactional proxy for the User Service -->
        <bean id="userService"
                class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
                <property name="transactionManager">
                        <ref local="transactionManager"/>
                </property>
                <property name="target"><ref local="userServiceTarget"/></property>
                <property name="transactionAttributes">
                        <props>
                                <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
                                <prop key="save*">PROPAGATION_REQUIRED</prop>
                                <prop key="update*">PROPAGATION_REQUIRED</prop>
                                <prop key="delete*">PROPAGATION_REQUIRED</prop>
                        </props>
                </property>
        </bean>
那位朋友有没有办法只注入一个基类的service吗?谢谢。
发表于 2007-5-6 18:13:51 | 显示全部楼层
1.如果文件较小.可以放在数据库中,如果很大,干脆ftp算了.
2.如果你学了hibernate spring,你就知道你问题的答案了.优化在于sql本身,当然,hibernate可以配置数据源
3 我只能一个一个注入.
 楼主| 发表于 2007-5-8 10:06:44 | 显示全部楼层
您需要登录后才可以回帖 登录 | 建立账号

本版积分规则

 
QQ在线咨询

QQ|小黑屋|手机版|Archiver|美河学习在线 ( 浙网备33020302000026号 )

GMT+8, 2025-5-4 06:29

Powered by Discuz!

© 2001-2025 eimhe.com.

快速回复 返回顶部 返回列表