To access database we use simple java classes called as xxxDAO.java. Where we open the connection, write the database related queries and return the results(Result set and Out parameter) to Session Beans, and close the connection. I was thinking to write one pattern where we can open the connection and access the corresponding DAO class and the pass the results and close the connection.
So in this way all Session Beans can invoke only one class, pass the required parameters and get the result.
Let me know if this makes sense to you all. Or there is any better approach.
-
Design Patterns to Access Data(DAO) objects. (6 messages)
- Posted by: Virendra S
- Posted on: April 16 2002 10:31 EDT
Threaded Messages (6)
- Design Patterns to Access Data(DAO) objects. by Neeraj Nargund on April 16 2002 11:09 EDT
- Design Patterns to Access Data(DAO) objects. by Virendra S on April 16 2002 11:14 EDT
- Design Patterns to Access Data(DAO) objects. by Virendra S on April 16 2002 11:31 EDT
- Design Patterns to Access Data(DAO) objects. by viren jasani on April 16 2002 13:15 EDT
-
Design Patterns to Access Data(DAO) objects. by Virendra S on April 17 2002 12:30 EDT
- Design Patterns to Access Data(DAO) objects. by Neeraj Nargund on April 19 2002 11:26 EDT
-
Design Patterns to Access Data(DAO) objects. by Virendra S on April 17 2002 12:30 EDT
- Design Patterns to Access Data(DAO) objects. by viren jasani on April 16 2002 13:15 EDT
-
Design Patterns to Access Data(DAO) objects.[ Go to top ]
- Posted by: Neeraj Nargund
- Posted on: April 16 2002 11:09 EDT
- in response to Virendra S
how is this any different than the DAO pattern.
one ?.
U open a Connection in the session bean....u say ?
think about the portabilty issues.If ur DB changes then u will have to recode the getConnection part fro DB.So if this is in the session bean then u will have to recomplie AND DEPLOY the bean again.
-
Design Patterns to Access Data(DAO) objects.[ Go to top ]
- Posted by: Virendra S
- Posted on: April 16 2002 11:14 EDT
- in response to Neeraj Nargund
I do not want to put the connection in session bean. But write one facade and get the connection there and then pass it DAO's. So all session beans will call only once class and get the result. -
Design Patterns to Access Data(DAO) objects.[ Go to top ]
- Posted by: Virendra S
- Posted on: April 16 2002 11:31 EDT
- in response to Virendra S
I forgot to mention one point here, we use user created result set which is basically a replica of java.sql.Result Set. So not to worry about the connection after returning the result set.
-
Design Patterns to Access Data(DAO) objects.[ Go to top ]
- Posted by: viren jasani
- Posted on: April 16 2002 13:15 EDT
- in response to Virendra S
If i am correct, You want to make a geeric class instead of class for each Bean.
In my EJB application i am using such 'Generic SQL Class' which can generate the SQL dynamically. Also it is used throughout my EJB application.
-Viren Jasani. -
Design Patterns to Access Data(DAO) objects.[ Go to top ]
- Posted by: Virendra S
- Posted on: April 17 2002 00:30 EDT
- in response to viren jasani
We are not writing any SQL coding except calling stored procedures and getting the result.
But yes, I want to make a generic class for calling DAO's. So the session bean will call only one object and that is the interface to all DAO's. -
Design Patterns to Access Data(DAO) objects.[ Go to top ]
- Posted by: Neeraj Nargund
- Posted on: April 19 2002 11:26 EDT
- in response to Virendra S
.. Soni
what about deployment issues..How will u package this class?