Hi everyone,

Is it possible to use SqlEntityProcessor in cached mode to repeat a query for a 
nested child element? I'd like to use the entity query once to consolidate 
information from the children to the parent, then another to actually index the 
entities as children. 

Here's an example of what I'm trying to do in the db-config file. The 
EventsTransformer consolidates information from child events and adds fields to 
the parent row. I had to add the two entities as the EventsTransformer will 
only add fields to the parent if child=false:

This is NOT working - the child event entities aren't being created 
<entity autoCommit="false" rootEntity="true" encoding="UTF-8" name="houses" 
query="select <parent fields> from houses">
    <entity 
        transformer="EventsTransformer"
        name="events"  
        query="select '${houses.uid}_events_' || e_id::text AS uuid,<event 
fields> from events">
    <entity
        child=true
        processor="SqlEntityProcessor" cachePrimaryKey="events_e_id" 
cacheLookup="events_parsed.events_e_id" cacheImpl="SortedMapBackedCache"
        name="events"  
        query="select <event fields> from events">
</entity>

This is IS working but the events query is being run twice so indexing is twice 
as slow

<entity autoCommit="false" rootEntity="true" encoding="UTF-8" name="houses" 
query="select <parent fields> from houses">
    <entity 
        transformer="EventsTransformer"
        name="events_parsed"  
        query="select '${houses.uid}_events_' || e_id::text AS uuid, e_id::text 
AS events_e_id,<event fields> from events">
    <entity
        child=true
        processor="SqlEntityProcessor" cachePrimaryKey="events_e_id" 
cacheLookup="events_parsed.events_e_id" cacheImpl="SortedMapBackedCache"
        transformer="EventsTransformer"
        name="events_child"  
        query="select <event fields> from events">
</entity>

Anyone got any idea how to do this? I've already tried nesting the second child 
entity inside the other but this didn't work.
Thanks,Kevin

Reply via email to