I'm trying to use SOLR DataImportHandler to feed data. Configuration was simple and straightforward and everything worked fine, when I was importing only one field from root entity.
But when I tried to import fields from nested entities, it doesn't work and I'm really puzzled and stuck.
Here is relevant snippet from my dataconfig:
<dataConfig>
<dataSource ... />
<document>
<entity name="a" query="select id, b_id from a" pk="id">
<entity name="b" query="select title from b where id ='${a.b_id}'">
<field column="title" name="title" />
</entity>
</entity>
</document>
</dataConfig>
When I try to debug import using DIH Development Console with verbose switched on, i can see something like:
...
<lst name="document#3">
<str>----------- row #1-------------</str>
<str name="ID">PST_210-SI.10 </str>
<str name="B_ID">6c2r3490seeqvb86pgb4c4trf9</str>
<str>---------------------------------------------</str>
−
<lst name="entity:b">
<str name="query">select title from b where id =''</str>
<str name="query">select title from b where id 开发者_Go百科=''</str>
<str name="query">select title from b where id =''</str>
<str name="time-taken">0:0:0.1</str>
<str name="time-taken">0:0:0.1</str>
<str name="time-taken">0:0:0.1</str>
</lst>
</lst>
I think the interesting point are the 3 queries in entity b, where the id field is empty. It seems to me, like the ${a.b_id} is not evaluated, but I can't find out why.
Can anyone help, please? Thanks in advance.
Ha, as usual - after spending whole afternoon trying to find out solution, when I run out all ideas and ask community a question.. I suddenly find the solution myself :)
The catch was case sensitivity - If you look properly on the verbose XML output, there is for some reason . So I tried to use expression ${a.B_ID} and it works!
Maybe the upper case could be speciffic only for Oracle JDBC driver.
精彩评论