diff --git a/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceTransactionManager.java b/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceTransactionManager.java index a10578b7..6934cff8 100644 --- a/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceTransactionManager.java +++ b/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/ContextSourceTransactionManager.java @@ -22,8 +22,10 @@ import org.springframework.ldap.transaction.compensating.TempEntryRenamingStrate import org.springframework.ldap.transaction.compensating.UnbindOperationExecutor; import org.springframework.ldap.transaction.compensating.support.DefaultTempEntryRenamingStrategy; import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.TransactionException; import org.springframework.transaction.compensating.CompensatingTransactionOperationExecutor; import org.springframework.transaction.compensating.CompensatingTransactionOperationRecorder; +import org.springframework.transaction.compensating.support.CompensatingTransactionObject; import org.springframework.transaction.compensating.support.DefaultCompensatingTransactionOperationManager; import org.springframework.transaction.support.AbstractPlatformTransactionManager; import org.springframework.transaction.support.DefaultTransactionStatus; @@ -101,9 +103,9 @@ import org.springframework.transaction.support.DefaultTransactionStatus; * same logic needs to be used if we want to wrap a JDBC and LDAP transaction in * the same logical transaction. *
- * + * * @author Mattias Hellborg Arthursson - * + * * @see ContextSourceAndDataSourceTransactionManager * @see ContextSourceTransactionManagerDelegate * @see DefaultCompensatingTransactionOperationManager @@ -156,7 +158,7 @@ public class ContextSourceTransactionManager extends /** * Get the ContextSource. - * + * * @return the contextSource. * @see ContextSourceTransactionManagerDelegate#getContextSource() */ @@ -166,7 +168,7 @@ public class ContextSourceTransactionManager extends /** * Set the ContextSource. - * + * * @param contextSource * the ContextSource. * @see ContextSourceTransactionManagerDelegate#setContextSource(ContextSource) @@ -177,7 +179,7 @@ public class ContextSourceTransactionManager extends /** * Set the {@link TempEntryRenamingStrategy}. - * + * * @param renamingStrategy * the Renaming Strategy. * @see ContextSourceTransactionManagerDelegate#setRenamingStrategy(TempEntryRenamingStrategy) @@ -189,4 +191,11 @@ public class ContextSourceTransactionManager extends public void afterPropertiesSet() throws Exception { delegate.checkRenamingStrategy(); } -} + + @Override + protected boolean isExistingTransaction(Object transaction) + throws TransactionException { + CompensatingTransactionObject txObject = (CompensatingTransactionObject) transaction; + return (txObject.getHolder() != null); + } +} \ No newline at end of file diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap321/Ldap321Test.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap321/Ldap321Test.java new file mode 100644 index 00000000..a3abd76b --- /dev/null +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap321/Ldap321Test.java @@ -0,0 +1,50 @@ +/* + * Copyright 2002-2015 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.ldap.itest.ldap321; + +import static org.junit.Assert.*; + +import java.util.Map; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.transaction.TransactionConfiguration; +import org.springframework.transaction.annotation.Transactional; + +/** + * @author Rob Winch + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration("classpath:ldap321.xml") +@TransactionConfiguration(transactionManager = "txManager",defaultRollback = true) +@Transactional +public class Ldap321Test{ + @Autowired + private RoleRepo roleRepo; + + @Test + public void testQueryRoleMap() throws Exception { + Map