English 中文(简体)
如何使用附有说明的交易顾问?
原标题:How to use transaction advisors with annotations?

我有以下例子:

@Transactional(propagation=Propagation.SUPPORTS, readOnly=true)
public class MyServiceImpl implements MyService {

    ...

    @Transactional(propagation=Propagation.REQUIRED, readOnly=false)
    public TransactionResponse addMyEntity(MyEntity e) throws SQLException{
        ...
    }

    ...
}

And in my applicationContext:

<tx:annotation-driven transaction-manager="txManager" />

我现在想在交易停止后添加一个拦截器,如果扔掉了一张空洞。 我如何能够这样做?

预 收

http://www.ohchr.org。

我试图澄清我试图做些什么:

我有一位世界展望组织,它坚持一些关于非行的信息,并回复(如果情况有错的话,那就是一个大豆和一种错误。)

如有例外情况增加,我需要:

  • Rollback the transaction
  • Build the response with the error message and return it to the client.

它就像在春季交易代理中的一种尝试/捕获物。

问题回答

使用<条码>条码属性<条码>tx:annotation-led,而拦截器将使用。 因此,你具体说明了哪一种情况。 见部分





相关问题
array dependency injection in spring?

is there a way to use dependency injection to inject all available implementations of a specific interface in spring? This is kind of the same thing as asked here for .NET. Though my aim is to use @...

Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Grails Packaging and Naming Conventions

Packaging Controllers, Services,etc. i.e. - com.company.controllers - com.company.services Is this a good practice or should be avoided by all means?? Another worth mentioning problem I encountered ...

How can I determine Objects in application context?

I am trying to write a portlet for Liferay (using Tomcat and Spring) and need to use a database via Persistence API/Hibernate. I am using some configuration XMLs (applicationContext.xml, etc.) and ...

How to prevent JPA from rolling back transaction?

Methods invoked: 1. Struts Action 2. Service class method (annotated by @Transactional) 3. Xfire webservice call Everything including struts (DelegatingActionProxy) and transactions is configured ...

热门标签