Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB 2.x - Remote vs Local lookup and usage  RSS feed

 
Anurag Gupta
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
My Application Architecture is like:


The DAO is present for loose coupling between Business and DataBase. The various DAO Implementations, which we could plug in:
  • CMP Entity Beans for DAO Implementation (using either of Remote/Local interfaces) <- This being the concern area.
  • JDBC for DAO Implementation


  • - There are no Web Module in the application

    Issues:
    1) Is it possible to look up a Entity Local Home from the POJO Business Utility, which is also deployed as a dependent jar file? If Yes, how?
    (It is possible to do so from an EJB or a Web Cointainer, by the use of ejb-local-ref in the Container deployment descriptor).

    2) In a Clustered enviornment, if two threads (on different cluster) are accessing the same Entity data row for updation, is there a possibility of compromising Data Integrity (Assuming Isolation Level is set as Cursor Stability i.e level 2).
     
    Daniel Rhoades
    Ranch Hand
    Posts: 186
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    In my opinion...

    1) Yes, but generally a bad idea - use a session bean facade to encapsulate access to the entity bean.

    2) Dependant on the locking mechanism used by the container -> database. If you are using a facade the container will only let one thread be in a session bean method at any one time (assuming both are calling the bean from the same remote reference).
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!