|
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吗?谢谢。 |
|