hi All:
    As we know the reality has never been perfect, i am working on a legacy 
system with bad designed DB tables and i can't modify the tables for some 
reason, i can only read. On perfect situation, Entity A has a list of Entity 
B (both mapped as MySql table with 1:n relationship), when one would like to 
get A with B, a simple RequestFactory call will do that: 
   em.findAs().with('bs').fire(....);

but the reality is that the A table does not has any relationship with B 
table, instead A table has a String column which store the B table item ids. 
can you imagine that? Now i want to get A with B, my plan is:

1. get the A entity using em.findA();
2. parse A's String field who contains many B's IDs, now i get: List<Long> 
ids.
3. iterator the id list, find allB entities.
4. store the list of B entities in A's list field. and return.

should work. but there is one problem: performance, often one A has many Bs 
references to it(say 100), if the web client want to get 10 A, then i have 
to do 10*100+1 times DB read operations.

my solution:
1. Cache all Bs in server memory and refer to it when i'd like to get it.
2. i notice that when the client want to get a list of A, there is no need 
to append Bs(findAllAs()), but if it want to get only one A that means the 
user want to see the details of A, i must append all Bs with A to the 
client.

Now problems comes, how can i distinguish the operation is getAllAs(int 
start, int size) or getA(Long id)? because the getAllAs(int start, int size) 
method also call getA(Long id).

i just using RequestFactory a few days and not quite familiar with it. hope 
somebody can help me with the solution.

Many thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to