On 17 March 2014 18:13, manju16832003 <manju16832...@gmail.com> wrote:
>
> I tried to use *CachedSqlEntityProcessor* in DataImportHandler with
> Sub-entity query. It does not seems to be working.
> Here is my query
> <entity name="listing" dataSource="mysql" query="SELECT id,make, model FROM
> LISTING">
>   <entity name="account" dataSource="mssql" query="SELECT name,email FROM
> CUSTOMER WHERE id='${listing.customer_id}'"
> processor="CachedSqlEntityProcessor">
>   </entity>
> </entity>
>
> If I remove *processor="CachedSqlEntityProcessor"*, run without
> CachedSqlEntityProcessor it works fine. With CachedSqlEntityProcessor my
> sub-entity some how fails to load the data?

Your outer entity selects 'id', but the inner one reference 'customer_id'.
Likewise, the inner entity does not select for the 'id' used in the where
clause.

If your tables are set up correctly, this should work:
<entity name="listing" dataSource="mysql" query="SELECT id,make, model FROM
LISTING">
  <entity name="account" dataSource="mssql" query="SELECT
id,name,email FROM CUSTOMER" cacheKey="id" cacheLookup="listing.id"
processor="CachedSqlEntityProcessor">
  </entity>
</entity>

Also, unless your field names in the tables exactly match those in the Solr
schema (including case), you should also have field entries inside the entities.
Please see the Solr DataimportHandler Wiki page.

Regards,
Gora

Reply via email to