Hi, i have tree structured data residing in a single table. for example: i have 3 columns A, B and C. for each A i have few rows of B, for each A-B combinaiton i have some rows of C. Clearly there will be repetation for the value of A & B. I want to represent this table as three different entity beans - Entity_A, Entity_B and Entity_C. Client needs to find obj Entity_A first, then based on Entity_A's id, it will search for obj Entity_B and so on. How can i implement this? Will BMP be a better choice than CMP? Needless to say, in Entity_A i want distinct A, not the repetations, same for B & C also.
You're talking about a table with a self reference, right? That should be easy to implement. Did you try searching on the web to determine if there is a well-known solution, perhaps a design pattern? I would try that first before asking for a solution. You'll never learn anything unless you do it on your own :-)
Also, it is probably best to prototype a few algorithms or pattern implementations in ordinary Java first. Then look at what you have in terms of controllers and entitities before transposing the best model onto a J2EE architecture.
First, you have problem with database design.
If you have that A, B and C (and so on) represent same concept it would be one table with self-reference (you will have parentID as foreign key)
Table1(KeyAttr, Attr2, Attr3, parentKey)
But, maybe you have problem with denormalization of your table with 3 attributes A, B and C.
To make normalized tables you need to perform decompoyition in 3 tables:
A(a) - a is key,
B(a,b) - a,b is complex key, and
C(a,b,c) - a,b,c is complex key.