public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
public void ejbCreate(){
//TODO Creation des instances classes
Salle salle[]=new Salle[20];
for (int i=0;i<20;i++){
salle[i].setNumero( new Integer(i) );
salle[i].setCapacite( new Integer(i) );
}
}
public void Reserver(Integer i){
try
{
Context initial=new InitialContext();
Object ref=initial.lookup("Salle");//recherche de l'objet salle
SalleHome home=(SalleHome) PortableRemoteObject.narrow(ref,SalleHome.class);
SalleObject salle=home.findByPrimaryKey(i);
salle.Reserver();
}catch(Exception e)
{
//catch exception here
}
}
}RessourceHome.Java
package PFE.Ressource;
import java.rmi.RemoteException;