Brian,

except for your sql-syntax error in the specie_relations-query "SELECT
specie_id FROMspecie_relations .." (missing whitespace after FROM)
your config looks okay.

following questions:
* is there a field named specie in your schema? (otherwise dih will
silently ignore it)
* did you check your mysql-query log? to see which queries were
executed and what their result is?

And, just as quick notice .. there is no need to use <field
column="foo" name="foo"> (while both attribute have the same value).

Regards
Stefan

On Mon, Feb 28, 2011 at 9:52 PM, Brian Lamb
<brian.l...@journalexperts.com> wrote:
> Hi all,
>
> I was able to get my dataimport to work correctly but I'm a little unclear
> as to how the entity within an entity works in regards to search results.
> When I do a search for all results, it seems only the outermost responses
> are returned. For example, I have the following in my db config file:
>
> <dataConfig>
>  <dataSource type="JdbcDataSource" name="mystuff" batchSize="-1"
> driver="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost/db?characterEncoding=UTF8&amp;zeroDateTimeBehavior=convertToNull"
> user="user" password="password"/>
>    <document>
>      <entity name="animal" dataSource="mystuff" query="SELECT * FROM
> animals">
>        <field column="id" name="id" />
>        <field column="type" name="type" />
>        <field column="genus" name="genus" />
>
>        <!-- Add in the species -->
>        <entity name="specie_relations" dataSource="mystuff" query="SELECT
> specie_id FROMspecie_relations WHERE animal_id=${animal.id}">
>          <entity name="species" dataSource="mystuff" query="SELECT specie
> FROM species WHERE id=${specie_relations.specie_id}">
>            <field column="specie" name="specie" />
>          </entity>
>        </entity>
>      </entity>
>    </document>
>  </dataSource>
> </dataConfig>
>
> However, specie never shows up in my search results:
>
> <doc>
>  <str name="type">Mammal</str>
>  <str name="id">1</str>
>  <str name="genus">Canis</str>
> </doc>
>
> I had hoped the results would include the species. Can it? If so, what is my
> malfunction?
>

Reply via email to