You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Julio Cesar Macavilca <jm...@tss.com.pe> on 2002/02/13 01:34:00 UTC

Question about loading adtional attributes

Hello

We are developing a large application in what the user in mayority of cases
perform tasks like edting documents as an Invoice (it means Invoice and
Items), but in fact more complex documents than a single master-detail
Invoie.

Imagine following tables:

Invoice table:
-------------
InvoiceId
CustomerId
Date
etc

InvoiceItem table
------------------
InvoiceId
InvoiceItemId
ProductId
Quantity
etc


In many of our jsp pages (we are using struts) we have :

(1) One record that represents Invoice row (Master)  enabled for editing
---------------------------------------------------------
| InvoiceId  |  CustomerId  |  *CustomerName*  |  Date  |
---------------------------------------------------------

(2) Many Items rows (Detail) on a grid allowed to edit too
----------------------------------------------------------------
| InvoiceId | InvoiceItemId | ProductId | *ProductName* |  Qty |
----------------------------------------------------------------


Note : We need to display two aditional Attributes : *CustomerName* and
*ProductName*  from other tables


In order to implement all this:

1) On EJB tier : We implement Invoice and InvoiceItem as EJB CMP 
   with relations among them
2) On EJB tier : We copy Invoice InvoiceItem to ValueObjects
3)             : Value Objects are sent to Web tier
4) On Web tier : Value value fills JSP form
5) On Web tier : JSP is displayed

6) Begins backward steps in order to update EJB's ....


Note that in one of this steps we need to populate the 'aditional attributes
*CustomerName* and *ProductName*'. Here we have two possibilities :

a) Between steps 1) and 2), after ejbLoad we can perfom 
   additional query in order to obtain adtional attribute 
   for each entity, or instantiate aditional EJB to retrieve
   it's attributes
b) On step 4) we can perfom the same additional query in order 
   to obtain adtional attribute for each value object


This will work, but it must be not performant, note that for each entity we
need to execute aditional. 
I suppose there must be any way in what I can perform a single query and
obtain all attributes needed but it broke my EJB CMP (by example a select
joined some tables like SELECT ... FROM InvoiceItem, Product...). 
I think on catching some tables too, I can do it for some, but it is
impossible to catching all Products or Customer table.

I read that frameworks like BC4J from Oracle or Data Express from Borland
offers this.

We are using Oracle and WebLogic6.1 if this helps.

Any ideas or comments??

//Julio

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