The steps happen in different methods.
I have 2 tables to_process and processed and the test looks something like this.
void unit_test(){
clearDatabase();
seedDatabase();
while (moreRows){
processRow();
}
}
where each function is a remote EJB call and
[i]clearDatabase[/i] does a bulk delete of all the rows and then calls em.cache();
[i]seedDatabase[/i] fills [b]to_process[/b] with some data, each call to seedDatabase generates the same rows with the same ids
[i]processRow[/i] selects a row for [b]to_process[/b], performs a task and writes it to [b]processed[/b]
It is in processRow i have the problem, when i try to write the record back using em.persist i get a EntityExistsException even though the underlying db is empty. I'm guessing this is the primary key of the "to be inserted" row is the same as one from the last pass which is still held in the cache. Judging by what you've said i cannot clear these from the cache unless i do em.remove()?
[Message sent by forum member 'jsl123' (jsl123)]
http://forums.java.net/jive/thread.jspa?messageID=217967