-
1. Re: Setting context for a JPA connection - is this safe?
marcuscf Mar 20, 2013 11:01 PM (in response to marcuscf)So I did some tests with JBoss 7.1.3: I set the connection pool to allow at most 1 connection to the database and created an EJB method that performs a database operation and waits for 30 seconds before returning to the caller.
I found out that in a transactional EJB method (e.g. where TransactionalAttribute is REQUIRED), the connection is not given to other clients during the whole transaction (just as I need). On the other hand, if there is no active transaction, the connection is released as soon as the JPA call ends, before the EJB method returns.
It looks like it is possible to do what I want (as long as I ensure that a transaction is active), but I don't know if this behavior is an implementation detail or if it is expected to be like this per the specification...
-
2. Re: Setting context for a JPA connection - is this safe?
marcuscf Jun 29, 2017 9:45 PM (in response to marcuscf)It looks like my answer came a bit too late here: Associate user with database connection from pool
I'm not sure which is the correct answer in that thread but it's better than nothing.