Rahul Babbar
However, i think closing the connection is equivalent to committing the transaction(not sure if it is right).
That way, do the transactions are committed only when the bean is destroyed(this is not true, so the above statement must be wrong).
Also, if we have 10 stateless beans in the pool, in the method ready state, all of them will have opened the DB connections(if the connections are opened in PostConstruct).
Wouldn't it be undesirable because there are 10 open connections with the DB, when none of the transaction is active.
Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Rahul Babbar
Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Leonardo Carreira wrote:Hi..
![]()
if you use only JDBC, i think its the right strategy..
as i mentioned in my first post, the PostConstruct method is used to get the resource (get the DB Connection)..
the DB connection is also mentioned as resource..
the PreDestroy is used to clean resource (used to close the DB Connection)..
Rahul Babbar
Best Regards,
Moayad Abu Jaber
SCJP 5.0, SCWCD 1.4, SCBCD 5.0
Moayad Abu Jaber wrote:if you used EJB3 and dependency injection. the opening connection and closing doesn't your job. cause the container offer to you to handle that.
Rahul Babbar
Best Regards,
Moayad Abu Jaber
SCJP 5.0, SCWCD 1.4, SCBCD 5.0
Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Rahul Babbar
Don't get me started about those stupid light bulbs. |