des enterprise beans - Département Informatique
des enterprise beans - Département Informatique
des enterprise beans - Département Informatique
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
La vie d’ un bean session<br />
L’interface SessionSynchronization<br />
Un bean session peut implémenter l’interface SessionSynchronization s’il<br />
veut être averti de l’état de toute transaction dans lequel il est impliqué.<br />
Seuls les <strong>beans</strong> session stateful utilisant <strong>des</strong> transactions gérées par le<br />
conteneur peuvent implémenter SessionSynchronization ; son utilisation est<br />
facultative. Les métho<strong>des</strong> de SessionSynchronization sont <strong>des</strong> callbacks<br />
effectués dans le bean par le conteneur, et elles marquent <strong>des</strong> points dans<br />
le cours de la transaction. Voici l’interface SessionSynchronization :<br />
public interface javax.ejb.SessionSynchronization<br />
{<br />
public abstract void afterBegin() throws RemoteException;<br />
public abstract void beforeCompletion() throws RemoteException;<br />
public abstract void afterCompletion(boolean completionStatus) throws<br />
RemoteException;<br />
}<br />
L’expert Enterprise JavaBean peut ajouter ces métho<strong>des</strong> à la classe de<br />
votre bean. Dans l’expert, cochez la case Synchronisation de session :<br />
l’expert déclarera les trois métho<strong>des</strong> dans la classe de votre bean, en<br />
laissant vide le corps de ces métho<strong>des</strong> :<br />
9-8 Guide du dé veloppeur Enterprise JavaBeans