beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Black <>
Subject Re: Doubts on Apache Beehive.
Date Sat, 03 Dec 2005 02:44:54 GMT
Hash: SHA1

Ricardo Constantino wrote:
> 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 mention it below, but if you use a temporary table to hold
uncommitted transactions, then you can open and close the connections,
so it will scale better, as you can handle hundreds or thousands of
simultaneous transactions.  You can decide when to delete the
uncommitted transactions, and you have safety, so that if the database
has to restart then the transactions aren't lost.

> 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.

  You can have a database layer, so you have:
database <-> database layer <-> multiple controllers

  The database layer is java code, but you can use hibernation, or any
number of other frameworks.  This can be very flexible, as you can have
different database layers for different databases, as they can be
swapped in and out, as long as they extend the same abstract classes or

  The database layer is in charge of connections.  So, you can have
connection pooling, if you desire, or a single connection per transaction.

  You can also just have a temporary table where you store uncommitted
transactions, for example. This is abstracted from the controllers.

  The controllers just ask the main database connection class for the
connection. It can either give a new one, if needed, or reuse one that
is part of the same transaction.

  The controllers would pass that connection to the other db layer
classes, so you can have separate classes for books, computers and

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


View raw message