Thanks Patrik!
There's one issue which still puzzles me. Do I have to write my own
rollback code for LDAP operations when a transaction rolls back? I
browsed the JNDI API and SPI and I couldn't figure out if JNDI somehow
supports transactions (like JDBC does with begin(), rollback() and
commit()).

If my code is following for instance:

UpdatingFacadeEJB implements SessionBean {
    public void doTheUpdate() {
       ldapDelegate.writeLdapEntry();
       rdbmsDelegate.writeRdbmsRow();
    }
}

Let's say that ldapDelegate.writeLdapEntry() succeeds but
rdbmsDelegate.writeRdbmsRow() fails by throwing an EJBException. In this
case can the container's transaction manager somehow rollback the LDAP
operations done earlier in ldapDelegate.writeLdapEntry() method?

-- 
Joni
[EMAIL PROTECTED]


> Patrik Andersson wrote:
> 
> You would have one sessionbean being business delegate in front of the
> EntityBean manipulating the RDBMS and another managing the LDAP
> directory service. Then you would have a Facade in front of both these
> sessionbeans with one method that does the whole trick with
> transactional attributes set up to require a transaction before
> entering the method.
> 
> interface UpdatingFacade : SessionBean {
>   void doTheUpdate() throws RemoteException;
> }
> 
> interface LdapDelegate : SessionBean {
>   void writeLdapEntry() throws RemoteException;
> }
> 
> interface RdbmsDelegate : SessionBean or EntityBean {
>   void writeRdbmsRow() throws RemoteException;
> }
> 
> Then you want an error in the writeLdapEntry() aswell as the
> writeRdbmsRow() to throw an EJBException breaking the transaction
> begun by doTheUpdate() method. Both writeXxx methods must require that
> a transaction already exists before being called. The doTheUpdate()
> method  can really have it either way, as long as there is an active
> transaction associated to the thread calling it.
> 
> regards,
> Patrik Andersson
> 
> -----Ursprungligt meddelande-----
> Fr�n: Joni Suominen [mailto:[EMAIL PROTECTED]]
> Skickat: den 6 juli 2001 08:32
> Till: Orion-Interest
> �mne: LDAP and EJBs
> 
> Hi everyone!
> I have a use case where I need to interface an LDAP directory and a
> relational database within a same transaction. That is, to create a
> new
> row to RDBMS from session bean using entity bean and to create an LDAP
> 
> entry from the same session bean using Sun's LDAP provider through
> JNDI.
> 
> 1. Is this possible?
> 
> 2. Can I use container managed transactions?
> 
> Thanks a lot!
> 
> --
> Joni
> [EMAIL PROTECTED]

Reply via email to