spring-transactions

Spring JTA configuration - how to set TransactionManager?

为君一笑 提交于 2019-11-30 11:06:41
问题 We configure our Spring transaction in Spring config as: <tx:jta-transaction-manager/> I gather this means that Spring will automatically discover the underlying JTA implementation. So when we start up JBoss we see these messages while Spring searches: [JtaTransactionManager] [ ] No JTA TransactionManager found at fallback JNDI location [java:comp/Tran sactionManager] javax.naming.NameNotFoundException: TransactionManager not bound <<Big stack trace>> <<More of the same>> And then eventually

Spring OpenSessionInViewFilter with @Transactional annotation

China☆狼群 提交于 2019-11-30 08:55:00
This is regarding Spring OpenSessionInViewFilter using with @Transactional annotation at service layer. i went through so many stack overflow post on this but still confused about whether i should use OpenSessionInViewFilter or not to avoid LazyInitializationException It would be great help if somebody help me find out answer to below queries. Is it bad practice to use OpenSessionInViewFilter in application having complex schema. using this filter can cause N+1 problem if we are using OpenSessionInViewFilter does it mean @Transactional not required? Below is my Spring config file <context

@Async and @Transactional: not working

狂风中的少年 提交于 2019-11-30 08:44:32
Please see code. When I called the method @Async loadMarkUpPCT(), data is NOT committed into the table. It behaves as if it's non-tractional. When I removed @Async from loadMarkUpPCT (Class 1), i.e. non-async, then data is committed and OK as expected: transactional) I was expecting to have the same result with @Async and @Transactional but it's NOT. Please explain or what did I do wrong? Edited: I just edited to post the code + log Flow-wise: AppDataLoaderController calls AppDataLoaderService calls DataMigrationService calls JpaDataMigrationDao package concepts.web.rest.resource.spring.impl;

Spring application has Cglib2AopProxy warnings

半腔热情 提交于 2019-11-30 03:55:18
Upon starting my application, I get numerous warnings along the lines of o.s.aop.framework.Cglib2AopProxy 'Unable to proxy method [public final void org.springframework.jdbc.core.support.JdbcDaoSupport.setDataSource(javax.sql.DataSource)] because it is final: All calls to this method via a proxy will be routed directly to the proxy.' for about a dozen or so functions. Now I perfectly understand that proxy-based aspects cannot be applied to final methods. However, I did not (on purpose, at least) try to weave any aspects into JdbcDaoSupport . I suspect it comes from <tx:annotation-driven /> .

Transaction management with Spring Batch

爱⌒轻易说出口 提交于 2019-11-30 02:59:13
I am discovering actually Spring and I am able to setup some jobs. Now, I would like to save my imported datas in a database using Hibernate/JPA and I keep getting this error : 14:46:43.500 [main] ERROR o.s.b.core.step.AbstractStep - Encountered an error executing the step javax.persistence.TransactionRequiredException: no transaction is in progress I see that the problem is with the transaction. Here is my spring java config for the entityManager and the transactionManager : @Configuration public class PersistenceSpringConfig implements EnvironmentAware { @Bean public

Spring JTA configuration - how to set TransactionManager?

不问归期 提交于 2019-11-29 23:17:48
We configure our Spring transaction in Spring config as: <tx:jta-transaction-manager/> I gather this means that Spring will automatically discover the underlying JTA implementation. So when we start up JBoss we see these messages while Spring searches: [JtaTransactionManager] [ ] No JTA TransactionManager found at fallback JNDI location [java:comp/Tran sactionManager] javax.naming.NameNotFoundException: TransactionManager not bound <<Big stack trace>> <<More of the same>> And then eventually see: [JtaTransactionManager] [ ] JTA TransactionManager found at fallback JNDI location [java:

Transaction Management using Hibernate with weblogic

瘦欲@ 提交于 2019-11-29 16:26:12
Our application is deployed on weblogic we use Hibernate and spring The session factory is created through a user defined class which creates SessionFactories by reading the hibernate.cfg.xml file So these are the steps : Our custom class is defined in spring application context and we inject the format of theCFG xml file in this class constructor : <bean id="myCustomFactoryCreator" class="com.xyz.CustomFactoryCreator" singleton="true"> <constructor-arg> <bean class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean" > <property name="staticField"> <value>com.xyz.MyConstants

Spring OpenSessionInViewFilter with @Transactional annotation

孤街浪徒 提交于 2019-11-29 12:37:39
问题 This is regarding Spring OpenSessionInViewFilter using with @Transactional annotation at service layer. i went through so many stack overflow post on this but still confused about whether i should use OpenSessionInViewFilter or not to avoid LazyInitializationException It would be great help if somebody help me find out answer to below queries. Is it bad practice to use OpenSessionInViewFilter in application having complex schema. using this filter can cause N+1 problem if we are using

Using Custom AnnotationTransactionAttributeSource with tx:annotation-driven

蹲街弑〆低调 提交于 2019-11-29 12:25:00
I need to use a Custom AnnotationTransactionAttributeSource in order to intercept transaction attributes. Right now, I do this using the TransactionInterceptor and injecting this in TransactionAttributeSourceAdvisor .The proxies are created using DefaultAdvisorAutoProxyCreator as given below. <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/> <bean class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor"> <property name="transactionInterceptor" ref="txInterceptor"/> </bean> <bean id="txInterceptor" class="org.springframework

Why doesn't Spring's @Transactional work on protected methods?

风格不统一 提交于 2019-11-29 11:31:46
From Does Spring @Transactional attribute work on a private method? When using proxies, you should apply the @Transactional annotation only to methods with public visibility. If you do annotate protected, private or package-visible methods with the @Transactional annotation, no error is raised, but the annotated method does not exhibit the configured transactional settings. I can think of good reasons to exclude private and package-private methods, but why won't protected methods behave transactionally? The following stacktrace displays the correct behaviour for a public method (called through