[testbox 2.3.0] don't flush the Session after an exception occurs

I have an app with flushatrequestend = false and cfc with this test method

`
public void function test_silent_activation_code_exists()
{

var subs = ecommerceService.getSubscriptions(returnFormat=“query”, page=1, rows=10, sortColumn="", sortOrder=“usedActivations DESC”, filters="", id="", email="", name="", expirationStart="", expirationEnd="", productIDList=“PRL10”, statusList=“active”,onlyPersonalSubscriptions=false);
var sub = EntityLoadByPK(“Subscription”, subs[“subscriptionID”][1]);
var activations = licenseService.getActivationsForSubscription(subscriptionID=sub.getSubscriptionID(), returnFormat=“query” );
var activation = EntityLoadByPK(“Activation”, activations[“activationID”][1]);
var serialNumber = activation.getSerialNumber();
var machineID = activation.getMachineID();
var expectedResult = activation.getActivationCode();
var result = licenseService.silentActivation(serialNumber=serialNumber,machineID=machineID,notes="",description="",username="",osVersion="",osBitVersion="",version="");
//ORMFlush();
$assert.isEqual(expectedResult,result,“result should’ve been ‘#expectedResult#’ but was #result#”);
}
`

In this test, an Activation entity will try to be created/inserted, the insert will fail but it caught in try/catch. The test passes.

If I run this test with our *Test.cfc’s it still passes, but the next test will fail like http://www.screencast.com/t/TyiGGE500kN

Apparently, Hibernate doesn’t like to flush the session after an exception has occurred, even if the exception is caught

I can replicate the problem in the test without having it run with other tests if I do ORMFlush() in the test method.

So to sum up, it seems there are issues running multiple test cases using ORM if one of the tests causes an ORM exception.

Any ideas to work around this?

I figured out a workaround. Doing

`
public void function tearDown(){
ORMCloseSession();
}

`

closes the session so each test has a fresh session.