I've been trying to write some test cases using JPA and can't seem to find a way to get OpenJPA to flush the cached beans between transactions. Basically, I've been trying to do this:

void test1() {
  cleanDB
  try {
    beginTx
    testSomething
    commitTx
  } finally {
    rollbackLeftOverTx
  }
}

void test2() {
  cleanDB
  try {
    beginTx
    testSomethingElse
    commitTx
  } finally {
    rollbackLeftOverTx
  }
}

My cleanDB code opens a direct connection to the DB and executes a "delete from foo". I know I could theoretically just use JPA to clean the db also, but there are tests where that simply isn't possible.

I also need to know how to force JPA to not cache data between transactions for clustered systems.

TIA,

-dain

Reply via email to