봄 @Transactional - 다음 스키마에서 javax.persistence.TransactionRequiredException
컨트롤러 -> 서비스 -> DAO 난 내가() 호출 내 UserService.fooFunction에
@Transactional 서비스 운영을 위해 노력하고있어 마지막 dao.update (E)에
Entity e = dao.find(key)
e.setProperty(something)
dao.update(e)
는
em.flush() //EntityManager obtained by @PersistenceContext annotation (injected by spring IoC)
존재() 플러시 드로우 요구하는 persistenceException : 내가 잘못 한 일을 나는 아이디어가 부족 해요
javax.persistence.TransactionRequiredException No externally managed transaction is currently active for this thread
at org.eclipse.persistence.internal.jpa.transaction.JTATransactionWrapper.throwCheckTransactionFailedException(JTATransactionWrapper.java:86)
는, 어떤 도움을 주시면 감사하겠습니다 :) 당신은 아래에있는 내 구성의 덩어리를 찾을 수 있습니다
:
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="persistenceUnitName" value="myPU" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter" id="eclipselinkVendorAdapter">
..
</bean>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
AOP 부 :
<aop:config>
<aop:pointcut id="userServiceOperation"
expression="execution(* org.mypackage.UserServiceImpl.*(..))"/>
<aop:advisor pointcut-ref="userServiceOperation" advice-ref="txUserServiceAdvice"/>
</aop:config>
<tx:advice id="txUserServiceAdvice">
<tx:attributes>
<tx:method name="get*" read-only="true" propagation="REQUIRES_NEW"/>
<tx:method name="update*" read-only="false" propagation="REQUIRES_NEW"/>
<tx:method name="*" propagation="REQUIRES_NEW"/>
</tx:attributes>
</tx:advice>
어떠한 트랜잭션 주석이 존재하지 않는다. . 주석 중심은 @Transactional 것이에 정의 된 같은 애플리케이션 컨텍스트 내에서 콩에 보이는 : 내 봄 응용 프로그램을 배포 할 때 하나
[<date>] DEBUG support.DefaultListableBeanFactory: Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
[<date>] DEBUG interceptor.NameMatchTransactionAttributeSource: Adding transactional method [get*] with attribute [PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT,readOnly]
[<date>] DEBUG interceptor.NameMatchTransactionAttributeSource: Adding transactional method [update*] with attribute [PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT]
[<date>] DEBUG interceptor.NameMatchTransactionAttributeSource: Adding transactional method [*] with attribute [PROPAGATION_MANDATORY,ISOLATION_DEFAULT]
예 - 나는 썬의 글래스 피시 애플리케이션 서버에서이 응용 프로그램을 실행 해요. 내 문제가 해결 된 것으로 생각합니다 :) 답장을 보내 주셔서 감사합니다! – Jan