@Service(value = "productTypeService")
public class ProductTypeService {
@Autowired
private ProductTypeDao productTypeDao; public ProductTypeService() { } public ProductTypeDao getProductTypeDao() {
return productTypeDao;
} public void setProductTypeDao(ProductTypeDao productTypeDao) {
this.productTypeDao = productTypeDao;
}
@Transactional public void create(ProductTypeEn productTypeEn) {
productTypeDao.saveEntity(productTypeEn);
}
}
以下是applicationContext.xml中关于事务的一些配置
  <aop:aspectj-autoproxy />
<context:annotation-config />
<context:component-scan base-package="com.lk" />
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean>
 
<aop:config>
            <aop:advisor advice-ref="profiler" pointcut="execution(* com.lk.sample.service.*Service.*(..) )"/>
    </aop:config>
    
    <bean id="profiler" class="com.lk.base.utils.Profiler"/>
    
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="url"
value="jdbc:sqlserver://127.0.0.1:1433; DatabaseName=slfp" />
<property name="username" value="sa" />
<property name="password" value="lucky" />
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
 <property name="dataSource" ref="dataSource" />
<!-- <property name="persistenceUnitName" value="ssj_unit" /> 如果不在这里配置数据源,也可以在引用persistence中的配置-->
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true" />
<!-- <property name="generateDdl" value="true" />  -->
</bean>
</property>
</bean>

<!-- <bean id="jDialect" class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>  -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
<!-- 这两个属性可以不用配置
<property name="dataSource" ref="dataSource"/>
<property name="jpaDialect" ref="jDialect"/> 
-->
</bean>
<tx:annotation-driven proxy-target-class="true" transaction-manager="transactionManager"/>--不知道哪里配置错了,事务没起到作用,保存数据里的时候,没有事务,数据不能保存!
请各位大虾帮帮忙,有点急!