As suggested by Figure 8 (Section 7.7.4) in the EJB 2.0 Specification, DB updates should be performed in the beforeCompletion method. May I ask why do you need to do that in the afterCompletion method?
afterComplition runs without transactional context. So, I guess, container will be complaining about using data source. And what will commit the changes you do?
In my opinion, beforeCompletion() method is lastest method that can be change commit or rollback transaction. afterCompletion(boolean flag) method is not run in transaction (non-TX) so in this method cannot commit or rollback. //if flag == true then commit //if flag == false then rollback please see detail in <b>life cycle of statefull session in EJB 2.0</b>
SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand