I am fairly new to EJBs. I am working on an existing system that has a bunch of BMPs.
Here is the code from the home interface (I have changed the names to protect the "innocent"):
When I saw this, I did not really understand why it was done this way. I wondering if there is someone here that may help me understand this. Why would you pass the java.sql.Connection to the finder method?
I asked around and was told that they do this because getting connections is one of the most resource intensive things you can do. OK. But use a pool, right? No. Those are too resource intensive, too, they say. So they get a connection themselves and then pass it to the beans they use. The theory is that doing it this way is faster.
Does this make any sense?
I sounds like it might be faster at first glance. But it also seems odd. Something inside of me pulls back and wants to die. But I don't know enough about this to trust myself gut instinct on it. There must be something better than this.
When I think about it, pools are better and faster than creating a new connection. No problem there. But is managing your own connections and passing them around better than pooling? Getting a connection from a pool would have a little overhead. But would it be enough to worry about so much so that you do this to your beans?
Is there a better design
pattern for this? Or is this a really good way to do it?
As a side note, what do you think about the naming scheme (putting BMP or CMP at the end of the bean name)?