Hi all

In the DIH configfile "database.xml" I defined an entity like this:

<entity name="entityName" dataSource="ds" pk="ID"
        transformer="org.apache.solr.handler.dataimport.DateFormatTransformer,
        org.apache.solr.handler.dataimport.TemplateTransformer"
        
        query="select t1.ID,
        ...
        t2.ID as OTHER_ID,
        ...
        from ${schema}.TABLE t1
        inner join ${schema}.OTHER_TABLE t2 on t1.ID = t2.T1_FK
        where ..."
        
        deltaQuery="select t1.ID
        from ${schema}.TABLE t1
        inner join ${schema}.OTHER_TABLE t2 on t1.ID = t2.T1_FK
        where t1.LASTUPDATE >
to_Date('${dataimporter.entityName.last_index_time}', 'yyyy-mm-dd
hh24:mi:ss')
        or t2.LASTUPDATE >
to_Date('${dataimporter.entityName.last_index_time}', 'yyyy-mm-dd
hh24:mi:ss')"
        
        deltaImportQuery="select t1.ID,
        ...
        t2.ID as OTHER_ID,
        ...
        from ${schema}.TABLE t1
        inner join ${schema}.OTHER_TABLE t2 on t1.ID = t2.T1_FK
        where t1.ID = '${dataimporter.delta.ID}'"
        onError="abort">
        
        <field name="id" template="${entityName.ID}_${entityName.OTHER_ID}" />
        ...
</entity>

With this definition, the full-load runs fine, but as soon as the
delta-loads run, I get a huge number (I guess 1 for every
delta-record) of warnings who say "WARNING: Unable to resolve
variable: entityName.OTHER_ID while parsing expression:
${entityName.ID}_${entityName.OTHER_ID}"
Actually this warning appears for every field used as template
variable except the ID field.

Therefore I have two questions:
1. What is the entity-attribute "pk" exactly for?
2. Why do I get these warnings? Is it because the "deltaQuery" does
not select "OTHER_ID"? I thought that "deltaQuery" only needs to
select the IDs of the records to be loaded with the
"deltaImportQuery".

Thanks for any help
Stefan

Reply via email to