No I changed the entity name to "dbA:project" but still the same problem.

Interesting sidenote If I use my Data-Config as posted (with the "id" field
in the comment section) none of the other entities works anymore like for
example:
"
entity name="user" dataSource="dbA" query="select username from
 ci_user where userid='${dbA.project.created_by}' ">
        <field column="username" name="created_by"/>
      </entity>
"
returns an empty result.

Still can´t figure it out why I cant use the (sql)tables primary key 
- once to save it in the index directly and
- twice to query against my comment table





Noble Paul നോബിള്‍  नोब्ळ्-2 wrote:
> 
> can you avoid "." dots in the entity name and try it out. dots are
> special characters and it should have caused some problem
> 
> On Tue, Jun 9, 2009 at 1:37 PM, gateway0<reiterwo...@yahoo.de> wrote:
>>
>> Ok here it goes:
>> "
>> <?xml version="1.0"?>
>> <dataConfig>
>>  <dataSource type="JdbcDataSource" name="dbA"
>> driver="com.mysql.jdbc.Driver"
>> url="jdbc:mysql://localhost:3306/dbA?zeroDateTimeBehavior=convertToNull"
>> user="root" password=""/>
>>  <document>
>>    <entity name="dbA.project" dataSource="dbA"
>> transformer="TemplateTransformer" query="select *, 'dbA.project' from
>> project">
>>      <!-- dbA.project , start -->
>>      <field column="id"
>> template="${dbA.project.dbA.project},id:${dbA.project.id}"/>
>>      <field column="id" name="db_id"/>
>>      <field column="def" template="${dbA.project.dbA.project}"/>
>>      <entity name="sys_types" dataSource="dbA" query="select stext from
>> sys_types where ftype=2 and sid='${dbA.project.type}' ">
>>        <field column="stext" name="type"/>
>>      </entity>
>>      <field column="name" name="name"/>
>>      <entity name="new_comment" dataSource="dbA" query="select cm_text
>> from
>> new_comment where ftype=2 and fid='${dbA.project.id}' ">
>>        <field column="cm_text" name="comment"/>
>>      </entity>
>>      <field column="deadline" name="deadline"
>> dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss"/>
>>      <field column="completion" name="completion"
>> dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss"/>
>>      <entity name="user" dataSource="dbA" query="select username from
>> ci_user where userid='${dbA.project.created_by}' ">
>>        <field column="username" name="created_by"/>
>>      </entity>
>>      <entity name="sys_stati" dataSource="dbA" query="select stext from
>> sys_stati where ftype=2 and sid='${dbA.project.state}' ">
>>        <field column="stext" name="state"/>
>>      </entity>
>>      <!-- 'phrase'-entity not found in table dbA.project -->
>>      <!-- dbA.project , end -->
>>    </entity>
>>  </document>
>> </dataConfig>
>> "
>> The name of the database is "dbA" and the table name is "project".
>>
>> Everything works out fine except the comment part highlighted (bold).
>> That
>> works to as I stated If I change the phrase to:
>> "
>> <entity name="new_comment" dataSource="dbA" query="select cm_text from
>> new_comment where ftype=2 and fid='${dbA.project.comment}' ">
>>        <field column="cm_text" name="comment"/>
>> </entity>
>> "
>> so that I don´t use my primary key "id" twice but the problem is I need
>> to
>> use "id" for the comment part too.
>>
>> kind regards, Sebastian
>>
>>
>> Noble Paul നോബിള്‍  नोब्ळ्-2 wrote:
>>>
>>> On Tue, Jun 9, 2009 at 12:41 AM, gateway0<reiterwo...@yahoo.de> wrote:
>>>>
>>>> Thanks for your answer.
>>>>
>>>> "${db.tableA.id}" that specifies the sql query that the
>>>> Dataimporthandler
>>>> should Use the sql field "id" in table "tableA" located in Database
>>>> "db".
>>>
>>> The naming convention does not work like that.
>>>
>>> if the entity name is 'tableA' then the field 'id' is addressed as
>>> 'tableA.id'
>>>
>>> As I said earlier, if you could privide mw with the entire
>>> data-config.xml it would be more helpful
>>>
>>>>
>>>> like in the example from the Solr Wiki:
>>>> "
>>>> <entity name="item_category" query="select CATEGORY_ID from
>>>> item_category
>>>> where item_id='${item.ID}'">
>>>> "
>>>>
>>>> It´s strange I know but when I use something other than "id" as the
>>>> foreign
>>>> key for the query everything works!
>>>>
>>>> like:
>>>> "${db.tableA.anotherid}"
>>>>
>>>>
>>>>
>>>> Noble Paul നോബിള്‍  नोब्ळ्-2 wrote:
>>>>>
>>>>> what is ${db.tableA.id} ?
>>>>>
>>>>> I think there is something extra in that
>>>>>
>>>>> can you paste the whole data-config.xml?
>>>>>
>>>>> can you paste
>>>>>
>>>>> On Sun, Jun 7, 2009 at 1:09 AM, gateway0<reiterwo...@yahoo.de> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I tried to do the following:
>>>>>>
>>>>>> "
>>>>>> <field column="id" name="db_id"/>
>>>>>>
>>>>>> <entity name="comment" dataSource="db" query="select com_text from
>>>>>> comment
>>>>>> where ftype=1 and fid='${db.tableA.id}' ">
>>>>>>        <field column="com_text" name="comment"/>
>>>>>> </entity>
>>>>>> "
>>>>>>
>>>>>> So I use the SQL Table Field "id" twice once for "db_id" in my index
>>>>>> and
>>>>>> for
>>>>>> the sql query as "fid=id".
>>>>>>
>>>>>> That doesn´t work!
>>>>>>
>>>>>> But when I change the query from "fid=id" to like "fid=otherkey" it
>>>>>> does
>>>>>> work!
>>>>>> Like:
>>>>>> "
>>>>>> <field column="id" name="db_id"/>
>>>>>>
>>>>>> <entity name="comment" dataSource="db" query="select com_text from
>>>>>> comment
>>>>>> where ftype=1 and fid='${db.tableA.otherkey}' ">
>>>>>>        <field column="com_text" name="comment"/>
>>>>>> </entity>
>>>>>> "
>>>>>>
>>>>>> Is there any other kind of a workaround so I can use the SQL Field
>>>>>> "id"
>>>>>> twice as I wanted to? Thanks
>>>>>>
>>>>>> kind regards, Sebastian
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/Use-the-same-SQL-Field-in-Dataimporthandler-twice--tp23904968p23904968.html
>>>>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> -----------------------------------------------------
>>>>> Noble Paul | Principal Engineer| AOL | http://aol.com
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Use-the-same-SQL-Field-in-Dataimporthandler-twice--tp23904968p23930286.html
>>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> -----------------------------------------------------
>>> Noble Paul | Principal Engineer| AOL | http://aol.com
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Use-the-same-SQL-Field-in-Dataimporthandler-twice--tp23904968p23938282.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> -----------------------------------------------------
> Noble Paul | Principal Engineer| AOL | http://aol.com
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Use-the-same-SQL-Field-in-Dataimporthandler-twice--tp23904968p23939391.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to