Why do you need to collect both primary keys T1_ID_RECORD and
T2_ID_RECORD in your delta query. Isn't T2_ID_RECORD primary key value
enough to get all data from both tables? (you have table1-table2
relation as 1-N, right?)

On Thu, Aug 11, 2011 at 12:52 AM, Eugeny Balakhonov <c0f...@gmail.com> wrote:
> Hello, all!
>
>
>
> I want to create a good DIH configuration for my Oracle database with deltas
> support. Unfortunately I am not able to do it well as DIH has the strange
> restrictions.
>
> I want to explain a problem on a simple example. In a reality my database
> has very difficult structure.
>
>
>
> Initial conditions: Two tables with following easy structure:
>
>
>
> Table1
>
> -          ID_RECORD    (Primary key)
>
> -          DATA_FIELD1
>
> -          ..
>
> -          DATA_FIELD2
>
> -          LAST_CHANGE_TIME
>
> Table2
>
> -          ID_RECORD    (Primary key)
>
> -          PARENT_ID_RECORD (Foreign key to Table1.ID_RECORD)
>
> -          DATA_FIELD1
>
> -          ..
>
> -          DATA_FIELD2
>
> -          LAST_CHANGE_TIME
>
>
>
> In performance reasons it is necessary to do selection of the given tables
> by means of one request (via inner join).
>
>
>
> My db-data-config.xml file:
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <dataConfig>
>
>    <dataSource jndiName="jdbc/DB1" type="JdbcDataSource" user=""
> password=""/>
>
>    <document>
>
>        <entity name="ent" pk="T1_ID_RECORD, T2_ID_RECORD"
>
>            query="select * from TABLE1 t1 inner join TABLE2 t2 on
> t1.ID_RECORD = t2.PARENT_ID_RECORD"
>
>            deltaQuery="select t1.ID_RECORD T1_ID_RECORD, t1.ID_RECORD
> T2_ID_RECORD
>
>                               from TABLE1 t1 inner join TABLE2 t2 on
> t1.ID_RECORD = t2.PARENT_ID_RECORD
>
>                               where TABLE1.LAST_CHANGE_TIME >
> to_date('${dataimporter.last_index_time}', 'YYYY-MM-DD HH24:MI:SS')
>
>                               or TABLE2.LAST_CHANGE_TIME >
> to_date('${dataimporter.last_index_time}', 'YYYY-MM-DD HH24:MI:SS')"
>
>            deltaImportQuery="select * from TABLE1 t1 inner join TABLE2 t2
> on t1.ID_RECORD = t2.PARENT_ID_RECORD
>
>            where t1.ID_RECORD = ${dataimporter.delta.T1_ID_RECORD} and
> t2.ID_RECORD = ${dataimporter.delta.T2_ID_RECORD}"
>
>        />
>
>    </document>
>
> </dataConfig>
>
>
>
> In result I have following error:
>
>
>
> java.lang.IllegalArgumentException: deltaQuery has no column to resolve to
> declared primary key pk='T1_ID_RECORD, T2_ID_RECORD'
>
>
>
> I have analyzed the source code of DIH. I found that in the DocBuilder class
> collectDelta() method works with value of entity attribute "pk" as with
> simple string. But in my case this is array with two values: T1_ID_RECORD,
> T2_ID_RECORD
>
>
>
> What do I do wrong?
>
>
>
> Thanks,
>
> Eugeny
>
>
>
>

Reply via email to