aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes EJB 2.1 - stateless ejbCreate doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB 2.1 - stateless ejbCreate doubt" Watch "EJB 2.1 - stateless ejbCreate doubt" New topic

EJB 2.1 - stateless ejbCreate doubt

Luciano A. Pozzo
Ranch Hand

Joined: Jun 20, 2005
Posts: 112
What is better? and why?

1 DAO initialization inside of ejbCreate

2 DAO initialization in the construtor or member variables declaration

3 Calling the DAO factory everytime that I need execute a DAO method

prasad kulkarni
Ranch Hand

Joined: Mar 19, 2006
Posts: 66
Use third approach, which is more suitable & preferable. Also use singleton patteren for the DAO layer, so that there will only one instance per jvm for a DAO class.

scjp, scwcd
I agree. Here's the link:
subject: EJB 2.1 - stateless ejbCreate doubt
Similar Threads
EJB Stateless Session Bean with DAOs
JBoss 5.1 ejbCreate method not called on mdb
why ejbCreate can't be invoked?
Help me see if possible Generic DAO Factory
stateless Session Bean Thread safety issue