You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Joao Araujo <jo...@wireless-networks.com> on 2002/11/27 17:37:10 UTC

Bean database access concepts

	
	I am not using EJB but plain beans to access the database.
	I defined everything in such a way to isolate  database access from action 
bean.
	Now, I have some doubts about how to access the database connection.
	Should I pass the connection as a parameter to the beans that accesss the 
datdabase, or
	should I use another method?

	Thanks a lot for your attention,


Joao,
	


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Bean database access concepts

Posted by "V. Cekvenich" <vi...@users.sourceforge.net>.
Bean does not access the db!

DAO access the db. (DAO can be implemented several ways)
Bean has a DAO helper.

DAO can get JNDI pool from container or make its own pool, based on 
properties.

Also, you should be able to unit test you beans for CRUD.

I wonder where the sample code that does this would be? I know, if I go 
to struts resources page and look for a DB sample, that would do it.

.V


> Joao Araujo wrote:
> 
>>     I am not using EJB but plain beans to access the database.
>>     I defined everything in such a way to isolate  database access 
>> from action bean.
>>     Now, I have some doubts about how to access the database connection.
>>     Should I pass the connection as a parameter to the beans that 
>> accesss the datdabase, or
>>     should I use another method?
>>
>>     Thanks a lot for your attention,
>>
>> Joao, 
> 
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Bean database access concepts

Posted by Eddie Bush <ek...@swbell.net>.
JNDI is a pretty good way to get connections.  You'll probably want to 
provide alternate signatures of your methods for allowing a connection 
to be passed to a "save" method though - so you can involve multiple 
beans in a single transaction.

Joao Araujo wrote:

>     I am not using EJB but plain beans to access the database.
>     I defined everything in such a way to isolate  database access 
> from action bean.
>     Now, I have some doubts about how to access the database connection.
>     Should I pass the connection as a parameter to the beans that 
> accesss the datdabase, or
>     should I use another method?
>
>     Thanks a lot for your attention,
>
> Joao, 

-- 
Eddie Bush




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>