Loading...

ojb-user@db.apache.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Unexpected result Carlos Chávez Wed Jul 09 13:30:20 2008

Hi johne.

I think you need to set the outer join against the object "region",
query.setPathOuterJoin("region");

Cheers,
Carlos Chávez.

> Hey all,
>
> Been a while since I had need to post.  I am looking forward to the new
> release as I am still on 1.0.3.  Thank you for all of the hard work Armin.
>
> Using 1.0.3, I am getting an unexpected result with one query using the PB.
>
> I am using this query:
>
>         QueryByCriteria query = new QueryByCriteria(objectClass);
>         query.addOrderByAscending("productGroupId");
>         query.addOrderByAscending("country.name");
>         query.addOrderByAscending("region.name");
>
>
> For this query, it is valid to have region names that are null.  Despite
> this, I would want those records to be included in the result set, but they
> are not.
>
>
>
> I am using this mapping:
>
> <!-- Definitions for the ServiceLocationVO object -->
> <class-descriptor
> class="com.jmjmedia.sp.model.service.activelocation.ServiceLocationVO"
>                   table="servicelocation">
>     
>     <field-descriptor
>         name="slId"
>         column="slid"
>         jdbc-type="BIGINT"
>         primarykey="true"
>         autoincrement="true"
>     />
>     <field-descriptor
>         name="productGroupId"
>         column="productgroupid"
>         jdbc-type="INTEGER"
>     />
>     <field-descriptor
>         name="countryId"
>         column="countryid"
>         jdbc-type="CHAR"
>     />
>     <field-descriptor
>         name="regionId"
>         column="regionid"
>         jdbc-type="CHAR"
>     />
>     
>     <reference-descriptor
>         name="country"
>         class-ref="com.jmjmedia.sp.model.places.CountryVO"
>         auto-retrieve="true"
>         auto-update="none"
>         auto-delete="none"
>         proxy="false">
>         <foreignkey field-ref="countryId"/>
>     </reference-descriptor>
>     
>     <reference-descriptor
>         name="region"
>         class-ref="com.jmjmedia.sp.model.places.RegionVO"
>         auto-retrieve="true"
>         auto-update="none"
>         auto-delete="none"
>         proxy="false">
>         <foreignkey field-ref="countryId"/>
>         <foreignkey field-ref="regionId"/>
>     </reference-descriptor>
>     
> </class-descriptor>
>
>
>
> <!-- Definitions for the Country object -->
> <class-descriptor class="com.jmjmedia.sp.model.places.CountryVO"
>       table="country">
>
>       <!-- -1 within a per class cache forces the cache to stay in memory. -->
>       <object-cache
>               class="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl">
>               <attribute attribute-name="timeout" attribute-value="-1" />
>       </object-cache>
>
>       <field-descriptor name="countryId" column="ccode" jdbc-type="CHAR"
>               primarykey="true" />
>       <field-descriptor name="name" column="cname" jdbc-type="VARCHAR" />
> </class-descriptor>
>
>
>
> <!-- Definitions for the Region object -->
> <class-descriptor class="com.jmjmedia.sp.model.places.RegionVO"
>       table="region">
>
>       <!-- -1 within a per class cache forces the cache to stay in memory. -->
>       <object-cache
>               class="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl">
>               <attribute attribute-name="timeout" attribute-value="-1" />
>       </object-cache>
>
>       <field-descriptor name="countryId" column="r_ccode" jdbc-type="CHAR"
>               primarykey="true" />
>       <field-descriptor name="regionId" column="rcode" jdbc-type="CHAR"
>               primarykey="true" />
>       <field-descriptor name="name" column="rname" jdbc-type="VARCHAR" />
> </class-descriptor>
>
>
>
>
>
>   


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