I have a SessionBean and a method where I am removing a CMP. I don't know why it
doesn't roll back. I have executed my code and the record is still getting deleted.
Even when I print ejbContext.getRollbackOnly(); the result is true. Why won't it
rollback the delete?
Here is the method:
/**
* Method used to remove all data associated to an Employee
* @ejb:interface-method view-type="both"
* @ejb:transaction type="Required"
**/
public boolean removePersonnelContainer(PersonnelContainer personnelContainer)
throws Exception{
// Start the logging time for this method
long startTime = cat.isInfoEnabled() ? System.currentTimeMillis() : 0;
if (cat.isDebugEnabled())
cat.debug("removePersonnelContainer - Remove the Personnel
with an ID of " + personnelContainer.getEmployee().getRecordId());
try {
ejbContext.getUserTransaction();
EmployeeData employeeData = personnelContainer.getEmployee();
Employee employeeBean = (Employee)
employeeHome.findByPrimaryKey(new EmployeePK(employeeData.getRecordId()));
employeeBean.remove();
ejbContext.setRollbackOnly();
throw new Exception("Rolled back transaction");
} catch (Exception e) {
cat.error("removeClient " +
personnelContainer.getEmployee().getRecordId(), e);
cat.error("Unable to remove the personnel with the given
personnel Primary Key.");
return false;
} finally {
LoggingUtils.infoElapsedTime((Logger) cat,
"removePersonnelContainer", startTime);
System.out.println("=====================>Rollback? " +
ejbContext.getRollbackOnly());
}
}
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3823430#3823430
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3823430
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user