Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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 Badass: Making Users Awesome this week in the Game Development 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