You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Paolo Salvan <pa...@omitech.it> on 2004/06/23 11:48:49 UTC

OJB/JSP app: how to structure it?

Hi!

I' starting the development of a non-trivial web app using ojb, mysql, and jsp...

I havent't clear ideas about which is the right moment to create/close the
various objects, to get the best architecture and to take advantage of the
connection-pooling.

In order to launch queries, to update data and so on, I need the following 3
objects:

- an ojb instance
- a db connection
- a transaction

I can create them at the global application level, at the user session level or
at the single jsp level... but it isn't obvius to me what is the right
solution... any help?

Thanks for the attention!

Paolo


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OJB/JSP app: how to structure it?

Posted by dennis bekkering <dj...@hotmail.com>.
> >
> You most certainly don't want to code business functionality right into
> the JSP. Your project sounds like it would benefit from the Struts
> framework, have a look here: http://jakarta.apache.org/struts/ and here
> for a tutorial: http://www.fawcette.com/javapro/2002_07/online/kjones/
> Also, there a few people here on the user mailing list that use OJB with
> Struts, so if you decide to use it, you will most certainly get your
> questions answered here :-)
>
> Tom

Paolo,

If you decide to go with struts then a tool that i recently released on
sourceforge might speed up your development. I haven't had any feedback on
it yet so let me know if it is of any help if you choose to try it.

project page is http://sourceforge.net/projects/or-mvc-gui/

greetings,
Dennis

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OJB/JSP app: how to structure it?

Posted by sa...@04web.com.
> Paolo Salvan wrote:
>
>>Hi!
>>
>>I' starting the development of a non-trivial web app using ojb, mysql,
>> and jsp...
>>
>>I havent't clear ideas about which is the right moment to create/close
>> the various objects, to get the best architecture and to take advantage
>> of the connection-pooling.

  connection-pooling... well JDBC 2.0 (or was it 3.0... or is just some
mixed up idea) drivers don't take care of connection pooling themselves?

>>
>>In order to launch queries, to update data and so on, I need the
>> following 3 objects:
>>
>>- an ojb instance

  just the PersistenceBroker, PersistenceManager or the ODMG equivalent is
needed. These must not be shared and be closed when finished (just like
JDBC connections).

>>- a db connection
>>- a transaction
>>
>>I can create them at the global application level, at the user session
>> level or at the single jsp level... but it isn't obvius to me what is
>> the right solution... any help?

  I usually initialize and share a factory (on JDO it is the
PersistenceBrokerFactory) among all DAOs to create the PersistenceBroker
or PersistenceManager.
  I use the VO (Value objects) to pass information between the DAO and the
actions (Struts).

>>
> You most certainly don't want to code business functionality right into
> the JSP. Your project sounds like it would benefit from the Struts
> framework, have a look here: http://jakarta.apache.org/struts/ and here
> for a tutorial: http://www.fawcette.com/javapro/2002_07/online/kjones/

  Struts will certainly be a good idea :)


Pedro Salgado



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OJB/JSP app: how to structure it?

Posted by Thomas Dudziak <to...@first.fhg.de>.
Paolo Salvan wrote:

>Hi!
>
>I' starting the development of a non-trivial web app using ojb, mysql, and jsp...
>
>I havent't clear ideas about which is the right moment to create/close the
>various objects, to get the best architecture and to take advantage of the
>connection-pooling.
>
>In order to launch queries, to update data and so on, I need the following 3
>objects:
>
>- an ojb instance
>- a db connection
>- a transaction
>
>I can create them at the global application level, at the user session level or
>at the single jsp level... but it isn't obvius to me what is the right
>solution... any help?
>
You most certainly don't want to code business functionality right into 
the JSP. Your project sounds like it would benefit from the Struts 
framework, have a look here: http://jakarta.apache.org/struts/ and here 
for a tutorial: http://www.fawcette.com/javapro/2002_07/online/kjones/
Also, there a few people here on the user mailing list that use OJB with 
Struts, so if you decide to use it, you will most certainly get your 
questions answered here :-)

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org