spring-transactions

Transaction Exception with Spring 4.0.6 + Weblogic 10.3.6 + EJB 3.0 CMT + Spring Data JPA 1.6.2 - “Error binding to externally managed transaction”

China☆狼群 提交于 2019-12-23 04:39:48
问题 I am having a weird, and hard to debug, issue using Weblogic 10.3.6, Spring 4.0.6, Spring Data JPA 1.6.2, Eclipselink (reproduced both the Weblogic embedded 2.3 version and the newest 2.5.2) and Container Managed Transactions. (I updated Weblogic to use JPA 2.0 installing the patch provided by Oracle). The issue is the following: I have a simple, stateless, EJB 3.0 in which I do use Spring Autowiring and spring-data-jpa repositories. When I do call any service exposed by the EJB, I get the

Spring Transactional annotation, isolation not working for READ_UNCOMMITTED

人盡茶涼 提交于 2019-12-23 03:29:32
问题 I have a method in Java which is wrapped by a spring Transactional annotation. I have 2 operations inside, one is delete , another one is insert . My insertion statement have to rely on the first operation (which is the delete ), but now because of the first operation is not committed yet, my insertion fail (unique constraint). But this is funny that, usually within the same transaction, I should be able to read/see the uncommited operation in the same transaction (my old proprietary

Spring Transaction Management: using @Transactional vs using AOP (<aop:advisor)

帅比萌擦擦* 提交于 2019-12-23 03:07:38
问题 I have a confusion about Spring transaction management. In my application I implemented transaction management using @Transactional in the service class. And I configured my spring.xml is like: <beans:bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <beans:property name="dataSource" ref="dataSource" /> <beans:property name="configLocation" value="classpath:hibernate.cfg.xml"/> <beans:property name="hibernateProperties"> <beans:props> <beans:prop key

Spring transactions - Mixing @Transactional with <tx:advice> into a custom annotation

核能气质少年 提交于 2019-12-23 02:34:27
问题 My goal is to have some way of declaring my service classes as transactional. I dont want to leave it as an explicit declaration in spring configuration. Many times in past we have created new services and forgot to declare transactions around them. Hence my intention is that if i have something like @TransactionalService custom annotation, it should do the following :- 1. provides transactional support 2. declares some default rules for transactional support as spring currently provides as

noRollbackFor not always working on unchecked exceptions (not a duplicate)

风格不统一 提交于 2019-12-22 17:48:36
问题 I've seen a lot of similar questions but they are usually just tangential to mine. Here is my code. @Override //class implements interface //can also add "rollbackFor = OutOfMemoryError.class" here, to no avail @Transactional(noRollbackFor = IllegalArgumentException.class) public ReportTemplate getByCode(final String code) //throws IllegalArgumentException - see question text { if(code == null) { throw new IllegalArgumentException("ss"); } } Consumer (non-transactional) calls this method via

Spring + Websphere 8.5: Unable to lookup JNDI name [java:comp/websphere/ExtendedJTATransaction]

六眼飞鱼酱① 提交于 2019-12-22 14:06:13
问题 There is a Websphere AS 8.5 where runs XA Datasource. Also there is a Spring application which must work in this environment and connect to the datasource. An application context is loaded by a servlet and the application uses RmiExporters to provide RMI access to some services (which are shared in the separate thread) and all DAOs' methods are marked with @Transactional . If I try to write something to the database from the main thread (e.g. during initialization of any class), it works

Spring + Websphere 8.5: Unable to lookup JNDI name [java:comp/websphere/ExtendedJTATransaction]

我的未来我决定 提交于 2019-12-22 14:05:39
问题 There is a Websphere AS 8.5 where runs XA Datasource. Also there is a Spring application which must work in this environment and connect to the datasource. An application context is loaded by a servlet and the application uses RmiExporters to provide RMI access to some services (which are shared in the separate thread) and all DAOs' methods are marked with @Transactional . If I try to write something to the database from the main thread (e.g. during initialization of any class), it works

Does Spring close connection after committing transaction?

為{幸葍}努か 提交于 2019-12-22 07:20:13
问题 I've recently read in one tutorial that Spring closes connection after transaction commit. Is that true? I can't find anything about it in the Spring reference documentation. What's the rationale behind it? Since now, I thought that there is a one-to-many relation between connection and transactions. 回答1: Spring calls close() when the transaction finishes which could be from either a commit or rollback. Whether or not close() actually closes a real JDBC connection depends on the DataSource

Grails integration tests and transactions

我怕爱的太早我们不能终老 提交于 2019-12-22 05:17:17
问题 I don't get why this integration test fails. I can get the test to pass by either removing the @Transactional(propagation = Propagation.REQUIRES_NEW) annotation above the service method, OR by setting transactional = false in the Integration Test I realize that the integration test itself is running in a transaction, and that's why I've got the annotation on the service method. class DbTests extends GrailsUnitTestCase { boolean transactional = true def customerService void

Spring:Propagation.REQUIRED not working

江枫思渺然 提交于 2019-12-22 01:30:58
问题 I am inserting records in a couple of tables namely Dept and Emp . If the Dept table is successfully created then only I want to insert records in Emp table. Also, if any of the insert in Emp fails, then I want to rollback all the transaction which includes both rollback from Emp as well as Dept tables. I tried this using Propagation.REQUIRED as shown below: Java File public void saveEmployee(Employee empl){ try { jdbcTemplate.update("INSERT INTO EMP VALUES(?,?,?,?,?)",empl.getEmpId(),empl