If performance is a problem with high data loads, you might want to rethink
what data is a entity bean.
As a mentioned earlier, an entity bean is a very expensive object. It is a
remote object and holds heavy transaction logic.

Earlier mail: Remember that in this example Table2 and Table3 data is
represented by normal java objects, not entity beans.

I would have entity beans reflect the data in Table1.
these entity beans could also contain the logic of inserting, reading and
updating data in table2 and table3. This data would be regular java
objects.
So in the entity bean for table1 I would have

Vector getTable2Data(...)
void deleteTable2Data(table2RowObject)
void addTable2Data(table2RowObject)

This way the main entity bean is in charge of the data in table2 and 3 and
you can control you database access in a better way.

Let me know if you want a more detailed description.

Filip Hanik
Verge Softawre






                    Sanjay Nambiar
                    <[EMAIL PROTECTED]>        To:     [EMAIL PROTECTED]
                    Sent by: A               cc:
                    mailing list for         Subject:     Re: A question about one to 
many relationships among
                    Enterprise               tables
                    JavaBeans
                    development
                    <EJB-INTEREST@jav
                    a.sun.com>


                    11/17/99 07:54 PM
                    Please respond to
                    A mailing list
                    for Enterprise
                    JavaBeans
                    development





Greetings,
As Chip Wilson pointed out I wanted to use the finder method with an extra
attribute in the entitybean of Table 1 (Collection Type) and a similar
approach in Table 2 .
The question is whether I could query the table2, from table1 entitybean
itself; and populate the extra attribute of Table1 as mentioned above i.e
the attribute would contain the bean references of all the records
retrieved
from Table2.Then using an iterate I could get the records of Table2 from
the
session bean for each record of Table1.

Here I would like to point out that I am NOT using a CMP Bean but bean
Managed Persistance.Additionally the real time data volumes of the tables
mentioned are very high.So performance is an other Problem.
DATABASE:Informix

Richad,Rickard,Ian any Pointers.......of a better solution????
Richard in your book you have shown a example of this type but I needed a
confirmation
Regards,
SANJAY
[Sanjay Nambiar]  ***************************************
> Sanjay !!
>
> Consider this approach and lemme know if it would work better !!!
>
>
> why dont u have table1, table 2, table 3 as cmps with just the normalised
> data and then have "table12" and "table23" which hold the relation
between
> the two tables (either "1 and 2" in table12 or "2 and 3" in table23)
>
>
> for example (using the standard tables for ease of explanation)
> _______________________________________________________________________
> table1  |table12        |table2 |table23                |table3
> _______________________________________________________________________
> department      |emp-dept       |employee       |emp-favTEAMS
> |favNFLTEAMS
> _______________________________________________________________________
>
> I know the 3rd table (favourite NFL TEAMS) kinda weird but I had nothing
> else in mind which would serve as a good example
> (;-))
>
> So store the PKs of table1 and table2 in table12 which is a two column
> table.
> The same applies to table2 and table3 utilising table23
>
> This way u can have 3 CMP beans mapping to tables 1,2 and 3
> ** U NEED TO CREATE 2 NEW tables *** 12 and 23 though which would be
> utilised by 2 new CMPs. The primary keys of these 2 tables would be the
> combination of the columns.
>
> U can use these CMPs in your session bean which might get a bit more
> complex
> but atleast you wont have problems with portability since every
> persistent
> bean is Container managed and you dont have to hardcode sql anywhere.
>
> I am not sure about the performance though but I would leave that to the
> gurus like Richard/Rickard/Ian..........
>
> Any comments???
> Regards
> Madhu
>
>
>
>
> -----Original Message-----
> From: Sanjay Nambiar [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 17, 1999 6:34 AM
> To: [EMAIL PROTECTED]
> Subject: A question about one to many relationships among tables
>
>
> Hi,
> Our application typically has the following scenario:
>
> 1>For Every Record of Table1 we have multiple records in Table2,in turn
> whose every record has multiple records in Table3.
> As the data volumes are very high,I wanted to know if the approach given
> below is right
> In the entity bean of Table 1 we have an extra attribute of say "Vector
> type" which would contain the bean references of all the entitybeans
> corresponding to Table 2.The same is done for the relationship between
> table
> 2 and table 3
> In the entityBean for Table 1 we query the Table 2 and populate the
> entitybean instances of Table 2 from Table 1 entitybean itself and store
> the
> bean references in the Vector and then this Table 1 entitybean is
accessed
> from the sessionbean for all the records.
>
> EJBServer supports bean managed persistence and the database is Informix
>
> Any comments ....or an alternative better approach
> SANJAY Nambiar
>
>
==========================================================================
> =
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
>
==========================================================================
> =
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to