JPA + websphere无法插入Record

时间:2013-05-03 23:33:01

标签: hibernate jpa spring-transactions websphere-8

下面是我的spring和spring_persistence.xml配置。 persist()操作不插入记录。没有错误..

WAS 8.5 App服务器 春季3.1 Hibernate 3.6.7

请帮忙!

<tx:annotation-driven  transaction-manager="transactionManager"/>
<context:annotation-config /> 

<bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager" >
    </bean>



<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" >
    <property name="dataSource" ref="dataSource"/>
    <property  name="persistenceUnitName" value="perstemplate"/>
    <property name="persistenceXmlLocation" value="classpath*:META-INF/myspring_persistence.xml"/>
      </bean> 

<persistence-unit name="perstemplate" transaction-type="RESOURCE_LOCAL">
  <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <class>com.mycompany.EntityClass</class>
     </persistence-unit>  

1 个答案:

答案 0 :(得分:0)

当您从Container使用TransactionManager时,您需要将事务类型设置为JTA