jQuery in Action, 3rd edition
The moose likes EJB and other Java EE Technologies and the fly likes EJB3 FactoryPattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB3 FactoryPattern" Watch "EJB3 FactoryPattern" New topic

EJB3 FactoryPattern

Syed Saifuddin
Ranch Hand

Joined: Sep 01, 2003
Posts: 130
Hi Everybody.

I am using EJB3 and want to use multiple db-layer or using 1 layer but want to design in a way so that if I want to replace the current layer with any other layer I dont have to make changes in code .
1 is JPA and
2 is Hibernate
Can I implement 1 EJB Remote in different Implementation is ok, or any suggestion or good design to do this.

Any help is really appreciated.

Thank You & Best Regards,

Syed Saifuddin,
Senior Software Engineer

SAP Oracle AIX & Java Training
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

Factory with simple facade will do for you.

Factory Class --> Instantiate and return you Facade class super interface.

FacadeInterface --> super interface.

Facade1 ---> implements a super interface and used to access(in your case) Hibernate.

Facade2 ---> implements a same interface as facade1 and used to access(in your case) JPA.

Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />prabhu.venkatachalam@gmail.com
I agree. Here's the link: http://aspose.com/file-tools
subject: EJB3 FactoryPattern
It's not a secret anymore!