Pedro,
> -----Original Message-----
> From: Pedro Salazar [mailto:[EMAIL PROTECTED]]
> Sent: Friday, November 15, 2002 4:06 PM
> Subject: entity beans: concepts
> 1) I would like to have a Entity Bean that would map not only a record
> from my database, but severals, and that I could manipulate that
> information in the Entity Bean class to be prepared to handle client
> requests. For example, I want create a Entity Bean that represents a
> Graph (several records), and I would like that Graph to be initialized
> in a specific data structure in my Java class, for I could
> run a routing
> algorithm (Dijkstra). Is this possible?
It's possible. Most of my entities is 'several records' and most have complicated primary keys.
For each entity I wrote a primary key class which represent unique set of data in a specific table (not one row!).
Each entity has its own public serializable class holding all the data in it.
Imaging the table with 6 million records with well production data, but for one well identifier its only up to 1000 records which I want to declare as entity. In this case, well production data entity have the primary key class with specified well identifer, layer id, source fields from this table.
class EWellProductionPK {
String wellId;
ArrayList layerId
ArrayList source;
...
}
Finder methods issues 'select' for this table for given criterias: for example find by wellId
will fill EWellProductionPK with all layerId & source combinations for that wellbore.
ejbLoad method then issue 'select * from table where wellId=? and layer_id in (?,...,?_ and source in (?,...,?)
and load all the data into the serializable object EWellProduction which have array of ArrayList and set, get methods
for every 'field'.
public EWellProduction implement java.io.Serializable {
ArrayList[] data;
public int size() {...}
public float getOil(int index)
public int getTime(int index)
public float getOilDebit(int index)
..
public void setOil(...)
...
}
On the client side its simple - find entity, the issue 'public EWellProduction getEWellProduction()' method of the EBean and use get/set methods of the class EWellProduction.
I've already implemented it in my application and the speed of the execution is satisfactory. The speed of the coding rise about 2 times comparing to using SessionBeans (now I don't need to code couple of SB methods issueing sql queries in each!). All the data strictly organized in the classes and most of errors can appear at compilation time. I'm happy :)
WBR,
Kirill Mikhailov
