| Also, you mentioned a doubt about what would happen "if the Session already has a connection that is enlisted into the active JTA transaction". That is not a valid use case imo. What happens to calls on a Session after the SessionFactory is closed is undefined. JPA well defines it for certain cases (certain specific exception requirements when calls are made on an EM after the EMF is closed). But certainly I think it is invalid to have an active Session and then alter the database schema in any way (including dropping it) and then having the Session work afterwards. That is just not a valid use case. Though certainly we want to make sure that the SF closing and schema dropping works. So maybe that is another scenario to test. |