On 18.02.2013 15:15, Wujek Srujek wrote:Hello,
What I don't understand:
1. how is it possible that the insertion is visible in the next select? there is no transaction, autoCommit is explicitly set to false, there is no caching like EntityManager cache - or is there?
Because you're in the same local transaction and you haven't yet rolled back what you have done so far?That I do not know (I've only looked at the code in your email).
2. how is it possible that the insertion is made persistent after the code executes, without the transaction ever being committed (either local or global) - I can see in a db viewer that the row has been added? the close() in finally seems to be doing magic things
You could try to enable client side tracing on the Derby network driver to see what's going on . Could it be that your application server / container is issuing a commit when it reclaims the connection?
I have not verified that Derby doesn't do the above for XA, but normally Derby throws an exception if close is called and there is an active transaction.
 See https://builds.apache.org/job/Derby-docs/lastSuccessfulBuild/artifact/trunk/out/adminguide/cadminappsclienttracing.html . The simpler server side tracing may also be to some help: derby.language.logStatementText=true