Hello,

I've got a simple problem  of collection's retrieve :
There are 2 tables : InfoData and ValueData with foreign key and datetime field
as it's describe  in my repository

<class-descriptor class="InfoData" table="INFO_DATA">
<field-descriptor name="id" column="ID" jdbc-type="INTEGER" primarykey="true"/>
   <field-descriptor name="name" column="NAME" jdbc-type="VARCHAR"/>
   <collection-descriptor
       name="listeValueData"
       element-class-ref="ValueData"
       auto-retrieve="true" auto-update="false" auto-delete="false">
<inverse-foreignkey field-ref="id"/> </collection-descriptor>
</class-descriptor>

<class-descriptor class="ValueData" table="VALUE_DATA">
<field-descriptor name="id" column="ID" jdbc-type="INTEGER" primarykey="true"/> <field-descriptor name="date" column="DATE" jdbc-type="TIMESTAMP" primarykey="true"/> <field-descriptor name="value" column="VALUE" jdbc-type="REAL"/> </class-descriptor>

So i would like , only record in my collection for an id and a date given
I try many of solutions to have a correct results like this one

Criteria criteres = new Criteria(); criteres.addEqualTo("id", new Integer(1)); criteres.addEqualTo("listeValueData.date", valueDate); QueryByCriteria q = new QueryByCriteria(InfoData.class, criteres); collection = broker.getCollectionByQuery(q);

with subquery or with QueryCustomizer (can not change the attribute on the fly ?).... and i have always got all the rows of the table VALUE_DATA

is there the generated sql  :

[http-8080-Processor4] 2006/01/11 17:03:21,663 DEBUG JdbcAccessImpl executeQuery: QueryByCriteria from class ame.gcr.domaine.instrument.InfoData where [id = 1, listeValueData.date = 2006-01-04 00:00:00.0] [http-8080-Processor4] 2006/01/11 17:03:21,663 DEBUG SqlQueryStatement$TableAlias TableAlias(): using hints ? false [http-8080-Processor4] 2006/01/11 17:03:21,663 DEBUG SqlQueryStatement$TableAlias TableAlias(): using hints ? false [http-8080-Processor4] 2006/01/11 17:03:21,663 DEBUG SqlGeneratorDefaultImpl Result of getTableAlias(): VALUE_DATA A1 [http-8080-Processor4] 2006/01/11 17:03:21,663 DEBUG SqlGeneratorDefaultImpl SQL:SELECT A0.ID,A0.NAME FROM INFO_DATA A0,VALUE_DATA A1 WHERE A0.ID=A1.ID AND ((A0.ID = ?) AND A1.DATE = ?) [http-8080-Processor4] 2006/01/11 17:03:21,679 DEBUG JdbcAccessImpl executeQuery: [EMAIL PROTECTED] [http-8080-Processor4] 2006/01/11 17:03:21,679 DEBUG JdbcAccessImpl executeQuery: QueryByCriteria from class ame.gcr.domaine.instrument.ValueData where [id = 1] [http-8080-Processor4] 2006/01/11 17:03:21,679 DEBUG SqlQueryStatement$TableAlias TableAlias(): using hints ? false [http-8080-Processor4] 2006/01/11 17:03:21,679 DEBUG SqlGeneratorDefaultImpl SQL:SELECT A0.ID,A0.DATE,A0.VALUE FROM VALUE_DATA A0 WHERE A0.ID = ? [http-8080-Processor4] 2006/01/11 17:03:21,679 DEBUG JdbcAccessImpl executeQuery: [EMAIL PROTECTED]

Thanks for your advice

Regards

Renaud


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to