I believe this is because you have auto-retrieve="false" in the reference
descriptors.  If you set these to true, the objects will be loaded.

Daniel.

> -----Original Message-----
> From: Alessandro Colantoni [mailto:[EMAIL PROTECTED]
> Sent: 24 November 2004 14:05
> To: 'OJB Users List'
> Subject: addPrefetchedRelationship problems
>
>
> Hi all.!!
>
> I have the following repository snip
>
> <class-descriptor class="com.brujulatelecom.srv.vo.CupoBloqueadoVO"
>                         table="T_SRV_CUPOBLOQUEADO"
> isolation-level="optimistic">
>             <field-descriptor id="1" name="cblCodigo"
> column="CBL_CODIGO"
>                   jdbc-type="INTEGER" primarykey="true"
> autoincrement="false"
>                   sequence-name="S_SRV_CBL"/>
>     <field-descriptor id="2" name="cblSalCodigo" column="CBL_SALCODIGO"
>                     jdbc-type="INTEGER" primarykey="true" />
>     <field-descriptor id="3" name="cblOfiCodigo" column="CBL_OFICODIGO"
>                     jdbc-type="INTEGER"/>
>
>     <field-descriptor id="4" name="cblPlazas" column="CBL_PLAZAS"
>                     jdbc-type="INTEGER"/>
>     <field-descriptor id="5" name="cblServidor" column="CBL_SERVIDOR"
>                     jdbc-type="VARCHAR"/>
>     <field-descriptor id="6" name="cblDateCreated"
> column="CBL_DATE_CREATED"
>                     jdbc-type="TIMESTAMP"/>
>     <field-descriptor id="7" name="cblDateModified"
> column="CBL_DATE_MODIFIED"
>                     jdbc-type="TIMESTAMP"/>
>     <field-descriptor id="8" name="cblModifiedBy"
> column="CBL_MODIFIED_BY"
>                     jdbc-type="VARCHAR"/>
>     <field-descriptor id="9" name="cblCreatedBy" column="CBL_CREATED_BY"
>                     jdbc-type="VARCHAR"/>
>     <field-descriptor id="10" name="cblBorrado" column="CBL_BORRADO"
>                     jdbc-type="CHAR"/>
>     <field-descriptor id="11" name="cblTemporada" column="CBL_TEMPORADA"
>                     jdbc-type="INTEGER"/>
>     <field-descriptor id="12" name="cblAckOptLock"
> column="CBL_ACKOPTLOCK"
>                     jdbc-type="INTEGER"
>                     locking="true"/>
>     <field-descriptor id="13" name="cblEreCodigo" column="CBL_ERECODIGO"
>                     jdbc-type="INTEGER"/>
>     <reference-descriptor name="salidaVO"
>                     class-ref="com.brujulatelecom.srv.vo.SalidaVO"
>                     auto-retrieve="false">
>       <foreignkey field-ref="cblSalCodigo"/>
>     </reference-descriptor>
>     <reference-descriptor name="oficinaVO"
>                     class-ref="com.brujulatelecom.srv.vo.OficinaVO"
>                     auto-retrieve="false">
>       <foreignkey field-ref="cblOfiCodigo"/>
>     </reference-descriptor>
> </class-descriptor>
>
> and I have the following method in my Dao
>
>
> public ValueObject findByPrimaryKey(String cblCodigo, String
> cblSalCodigo)throws DataAccessException{
>         log.info("************Entering the
> CupoBloqueadoDAO.findByPrimaryKey(String cblCodigo, String
> cblSalCodigo)***************");
>         PersistenceBroker broker = null;
>         CupoBloqueadoVO cupoBloqueadoVO = null;
>         try{
>             Criteria criteria = new Criteria();
>
>
> criteria.addEqualTo("cblTemporada",ServiceParametro.getInstance().getVal
> TemporadaActual());
>
>             //criteria.addEqualTo("cblBorrado","N");
>             criteria.addEqualTo("cblCodigo",new Integer(cblCodigo));
>             criteria.addEqualTo("cblSalCodigo",new
> Integer(cblSalCodigo));
>             broker = ServiceLocator.getInstance().findBroker();
>             //QueryByCriteria query = new
> QueryByCriteria(CupoBloqueadoVO.class, criteria);
>             QueryByCriteria query =
> QueryFactory.newQuery(CupoBloqueadoVO.class, criteria);
>             query.addPrefetchedRelationship("salidaVO");
>             query.addPrefetchedRelationship("oficinaVO");
>             cupoBloqueadoVO =
> (CupoBloqueadoVO)broker.getObjectByQuery(query);
>
>         } catch (ServiceParametroException e){
>             log.error("ServiceParametroException thrown in
> CupoBloqueadoDAO.findByPrimaryKey(String cblCodigo, String
> cblSalCodigo): " + e.toString());
>             throw new DataAccessException("Error in
> CupoBloqueadoDAO.findByPrimaryKey(String cblCodigo, String
> cblSalCodigo): " + e.toString(),e);
>         }catch (ServiceLocatorException e) {
>             log.error("ServiceLocatorException thrown in
> CupoBloqueadoDAO.findByPrimaryKey(String cblCodigo, String
> cblSalCodigo): " + e.toString());
>             throw new DataAccessException("Error in
> CupoBloqueadoDAO.findByPrimaryKey(String cblCodigo, String
> cblSalCodigo): " + e.toString(),e);
>         } finally {
>                   if (broker != null) broker.close();
>         }
>         log.info("************Done with the
> CupoBloqueadoDAO.findByPrimaryKey(String cblCodigo, String
> cblSalCodigo)***************");
>         return cupoBloqueadoVO;
>     }
>
>
>
> The cipoBloquadoVO I return has oficinaVO and salidaVO empties!!
>
> Where I am wrong??
>
> Every suggestion will be helpful.. thanks in advance
>
>
>


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

Reply via email to