Announcement Announcement Module
Collapse
No announcement yet.
txAdvice not getting applied ever occasion Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • txAdvice not getting applied ever occasion

    Hi Guys,
    I have run into some wierd problem around txAdvice where I have got stuck.
    Basically from my code ,I am calling
    Code:
    iCreateConService.createCon(createConDTO)
    My TxAdvice and point cut are as below
    Code:
    <tx:advice id="txAdvice">
    		<!-- the transactional semantics... -->
    		<tx:attributes>
    			<!-- all methods starting with 'get' are read-only -->
    			<tx:method name="get*" read-only="true" />
    			<!-- other methods use the default transaction settings (see below) -->
    			<tx:method name="*" />
    		</tx:attributes>
    	</tx:advice>
    
    
    
    		<aop:advisor advice-ref="txAdvice" pointcut-ref="createCon"/>
    
    
    <aop:pointcut id="createCon" 
            	expression="execution(* al.am.business.createcon.ICreateConService.*(..))"/>
    .

    Now Whenever I am calling iCreateConService.createCon(createConDTO),I am running into some transaction blues.

    On further debugging I found that advice is not applied across iCreateConService always.
    But sometimes advice does get applied and transaction is created like below
    Code:
    2012-03-27 23:35:00,140 INFO  [STDOUT] Rip is executing
    2012-03-27 23:15:00,278 DEBUG [org.springframework.orm.jpa.JpaTransactionManager] Using transaction object [org.springframework.orm.jpa.JpaTransactionManager$JpaTransactionObject@2fc718bd]
    2012-03-27 23:15:00,278 DEBUG [org.springframework.orm.jpa.JpaTransactionManager] Creating new transaction with name [al.am.business.createcon. ICreateConService.createCon]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
    2012-03-27 23:15:00,278 DEBUG [org.springframework.orm.jpa.JpaTransactionManager] Opened new EntityManager [org.eclipse.persistence.internal.jpa.EntityManagerImpl@382938cc] for JPA transaction
    2012-03-27 23:15:00,279 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] Bound value [org.springframework.orm.jpa.EntityManagerHolder@1a4ff5e2] for key [[email protected]4] to thread [EftScheduler_Worker-1]
    2012-03-27 23:15:00,279 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] Initializing transaction synchronization
    2012-03-27 23:15:00,279 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] Getting transaction for [al.am.business.createcon. ICreateConService.createCon]
    2012-03-27 23:15:00,279 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] Retrieved value [org.springframework.orm.jpa.EntityManagerHolder@1a4ff5e2] for key [[email protected]4] bound to thread [EftScheduler_Worker-1]
    2012-03-27 23:15:00,279 DEBUG [org.springframework.orm.jpa.JpaTransactionManager] Found thread-bound EntityManager [org.eclipse.persistence.internal.jpa.EntityManagerImpl@382938cc] for JPA transaction
    2012-03-27 23:15:00,279 DEBUG [org.springframework.orm.jpa.JpaTransactionManager] Using transaction object [org.springframework.orm.jpa.JpaTransactionManager$JpaTransactionObject@7797d5ec]
    2012-03-27 23:15:00,279 DEBUG [org.springframework.orm.jpa.JpaTransactionManager] Participating in existing transaction
    2012-03-27 23:15:00,279 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] Getting transaction for [al.am.business.createcon. ICreateConService.createCon


    But sometimes when advice is not applied.You can see the below logs doesnt show anything.
    Code:
    2012-03-27 23:35:00,140 INFO  [STDOUT] Rip is executing
    2012-03-27 23:35:00,141 DEBUG [org.springframework.orm.jpa.JpaTemplate] Creating new EntityManager for JpaTemplate execution
    2012-03-27 23:35:00,141 DEBUG [gl.am.framework.dao.QueryBuilder] Query = select model from EventRuleFlowMap model  WHERE  model.processTemplateCode = :processTemplateCode AND  model.processTemplateTypeCode = :processTemplateTypeCode
    2012-03-27 23:35:00,142 DEBUG [org.springframework.orm.jpa.JpaTemplate] Closing new EntityManager after JPA template execution
    2012-03-27 23:35:00,142 DEBUG [org.springframework.orm.jpa.EntityManagerFactoryUtils] Closing JPA EntityManager
    2012-03-27 23:35:00,142 INFO  [al.am.integration.dao.jpa.businessruleflow.BusinessRuleFlowDAO] finding BusinessRuleFlow instance with id: rf1_cc
    2012-03-27 23:35:00,144 DEBUG [org.springframework.orm.jpa.JpaTemplate] Creating new EntityManager for JpaTemplate execution
    2012-03-27 23:35:00,145 DEBUG [org.springframework.orm.jpa.JpaTemplate] Closing new EntityManager after JPA template execution
    2012-03-27 23:35:00,145 DEBUG [org.springframework.orm.jpa.EntityManagerFactoryUtils] Closing JPA EntityManager
    2012-03-27 23:35:00,146 INFO  [al.am.integration.dao.jpa.businessruleser
    Can someone please let me know where I am going wrong or point me in the correct direction

  • #2
    I have finally found the way around this problem
    It looked to be some issue with the Spring 2.5.
    Earlier the affected bean definition was in one of the xml files which was then imported into the application context.

    I moved the bean definition to the applicationContext which suprisingly solved the problem.

    Comment

    Working...
    X