Thanks James,

The problem of open and close more than 1 connection is that I can't have
one transaction.

For example:

If I have a database controller with all the db queries used to maintain a
customer records and another database controller to maintain the inventory
of goods. If I've an action of selling goods to a customer where I have to
update the customer debt and the goods inventory, i've to use the 2 database
controller with 2 database connections, because if I make the customer
update and close connection and after that update the goods inventory and I
can't have one transaction.

I already saw that your solution for this problem is putting the database
code in the database, but this type of solutions gives less flexibility of
changing the environment.

The EJB framework for example allows to define if an ejb starts a new
transaction/connection or if use one that comes from another EJB.

Thanks again,
Ricardo Constantino

-----Original Message-----
From: James Black [mailto:[EMAIL PROTECTED] 
Sent: sábado, 3 de Dezembro de 2005 0:45
To: Beehive Users
Subject: Re: Doubts on Apache Beehive.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ricardo Constantino wrote:
> In beehive since actions are methods, these way of working is not possible
> and since the pageflow is jpf file is not possible to create a base
pageflow
> to implements the same generic code.

  It may be splitting hairs, but page flows can be java source files
also, and the jpf file can extend classes, so you can have generic code
that all page flows use.

  For the database controller issue, you can redesign your controller
logic a bit.

  For example, you can just open and close connections for each
function, so that when it goes back to the page, you have closed that
connection.

  Move your database functions into a database layer, and the
controllers can use those classes. I probably have 10 different classes
in my database layer, for example, so that I can group my database
functions in a logical way.  The controllers shouldn't go directly to
the db anyway.

  If there is one common class for a database connection, then you can
pass that around to the database layer, and retrieve it from there, so
the different controllers can use the same connection.

  You can also just use a database pool, so you get and release
connections quickly, right after you are done with them.

  This problem isn't a problem, depending on your architecture.


- --
Corruptisima republica plurimae leges. [The more corrupt a republic, the
more laws.]
Tacitus from Annals III, 116AD
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFDkOqFJ/zyYkX46joRAlAEAJ9gqvWoaoAAM0KCdfQrRZnViP3/HgCfd4Ro
CWGjSrTkwrEphUUVbzhDbGg=
=SrCK
-----END PGP SIGNATURE-----

Reply via email to