-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Transaction Not Rolling Back
PostPosted: Tue May 03, 2005 9:46 am 
Newbie

Joined: Tue May 03, 2005 5:26 am
Posts: 1
Hello

I am using Spring 1.1. with Hibernate 2. The Spring transaction does not roll back when used in conjunction with Hibernate. I'm aware that this may be a Spring issue and is therefore not completely relevant but it may be Hibernate that is causing my problem.

The contents of my Spring configuration file are as follows:

<property name="transactionAttributes">
<props>
<prop key="delete*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="create*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="update*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="process">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="authorise*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="terminate*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="cancel*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="find*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="test*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="warn*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>


Code between sessionFactory.openSession() and session.close():

public final void testUpdateSwapRollback()
throws .......ValidationException, HibernateException {
LOG.debug("testUpdateSwapRollback starting...");

boolean testPassed = false;
Swap swap = null;

try {

// Create a swap and attempt to update it
SwapRequest swapRequest = toSwapRequest();
Long swapId = swapService.createSwap (swapRequest);

// Locate the swap
try {
swap = getSwapDao ().findSwapByPrimaryKey(new BigDecimal(swapId.longValue()));
} catch (ObjectRetrievalDAOException e) {

LOG.info(
"SwapServiceTest: testUpdateSwapRollback called findSwapByPrimaryKey and a swap was NOT returned",
e);
} catch (FinderDAOException e) {

LOG.error(
"testUpdateSwapRollback called findSwapByPrimaryKey and a swap was NOT returned",
e);

throw new XXXSystemException(
"testUpdateSwapRollback called findSwapByPrimaryKey and a swap was NOT returned", e);
}

// Modify the swap so that the effective date is 2 months BEFORE the trade date causing a ValidationException to be thrown

modifySwapInvalid(swap);

} catch (ValidationException e) {

LOG.info(
"testUpdateSwapRollback - Examine the database to see if the effective date for swap: "
+ swap.getSwapId()
+ " is before the trade date.",
e);

assertEquals(testPassed, true);
}

LOG.debug("testUpdateSwapRollback completed.");
}

Name and version of the database you are using:
Oracle 9i

Can anyone explain why the actions of the method modifySwapInvalid(swap) are not being rolled back?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 03, 2005 11:10 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
This would be a Spring question; Hibernate does not control transactions.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.