You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Raul Giucich <ra...@gmail.com> on 2005/02/19 17:32:43 UTC

Problem with load Collection

I am  newbie OJB user and I have a problem. When retrieve a user
(serco.dao.usuarios.Usuarios), the tBLPERMISOSList
(serco.dao.usuarios.Permisos) are empty.
 If not I'm wrong the auto-retriev="true" should be load the
collections from the 'n' side.
Really sorry for my foreign English.

Thanks. R.

The repository.xml portion is:

<class-descriptor class="serco.dao.usuarios.Operaciones"
table="TBL_OPERACIONES">
		<field-descriptor name="iDOPERACION" primarykey="true"
default-fetch="true" autoincrement="true" column="ID_OPERACION"
jdbc-type="INTEGER"/>
		<field-descriptor name="dESCRIPCION" default-fetch="true"
column="DESCRIPCION" jdbc-type="LONGVARCHAR"/>
		<field-descriptor name="uRL" default-fetch="true" column="URL"
jdbc-type="VARCHAR"/>
		<field-descriptor name="aCTIVA" default-fetch="true" column="ACTIVA"
jdbc-type="CHAR"/>
		<collection-descriptor name="plantillasOPERACIONESList"
element-class-ref="serco.dao.usuarios.PlantillasOperaciones"
auto-update="false" auto-delete="false">
			<inverse-foreignkey field-ref="iDOPERACION"/>
		</collection-descriptor>
		<collection-descriptor name="tBLPERMISOSList" auto-retrieve="true"
element-class-ref="serco.dao.usuarios.Permisos" auto-update="false"
auto-delete="false">
			<inverse-foreignkey field-ref="iDOPERACION"/>
		</collection-descriptor>
	</class-descriptor>


	<class-descriptor class="serco.dao.usuarios.Permisos" table="TBL_PERMISOS">
		<field-descriptor name="iDPERMISO" primarykey="true"
default-fetch="true" column="ID_PERMISO" jdbc-type="INTEGER"/>
		<field-descriptor name="iDUSUARIO" primarykey="true"
default-fetch="true" column="ID_USUARIO" jdbc-type="INTEGER"/>
		<field-descriptor name="idPersona" primarykey="true"
default-fetch="true" column="IDPERSONA" jdbc-type="INTEGER"/>
		<field-descriptor name="idOrganizacion" primarykey="true"
default-fetch="true" column="IDORGANIZACION" jdbc-type="INTEGER"/>
		<field-descriptor name="idCentro" primarykey="true"
default-fetch="true" column="IDCENTRO" jdbc-type="INTEGER"/>
		<field-descriptor name="iDOPERACION" primarykey="true"
default-fetch="true" column="ID_OPERACION" jdbc-type="INTEGER"/>
		<reference-descriptor name="tBLUSUARIOS"
class-ref="serco.dao.usuarios.Usuarios" auto-update="false"
auto-delete="false">
			<foreignkey field-ref="iDUSUARIO"/>
			<foreignkey field-ref="idPersona"/>
                        <foreignkey field-ref="idOrganizacion"/>
                        <foreignkey field-ref="idCentro"/> 
		</reference-descriptor>
       		<reference-descriptor name="tBLOPERACIONES"
auto-retrieve="true" class-ref="serco.dao.usuarios.Operaciones"
auto-update="false" auto-delete="false">
			<foreignkey field-ref="iDOPERACION"/>
		</reference-descriptor>
	</class-descriptor>


        <class-descriptor class="serco.dao.usuarios.Usuarios"
table="TBL_USUARIOS">
		<field-descriptor name="iDUSUARIO" primarykey="true"
default-fetch="true" autoincrement="true" column="ID_USUARIO"
jdbc-type="INTEGER"/>
		<field-descriptor name="idCentro" primarykey="true"
default-fetch="true" column="IDCENTRO" jdbc-type="INTEGER"/>
		<field-descriptor name="idOrganizacion" primarykey="true"
default-fetch="true" column="IDORGANIZACION" jdbc-type="INTEGER"/>
		<field-descriptor name="idPersona" primarykey="true"
default-fetch="true" column="IDPERSONA" jdbc-type="INTEGER"/>
		<field-descriptor name="iDGRUPO" nullable="false"
default-fetch="true" column="ID_GRUPO" jdbc-type="INTEGER"/>
		<field-descriptor name="nombreusuario" nullable="false"
default-fetch="true" column="NOMBRE_USUARIO" jdbc-type="VARCHAR"/>
		<field-descriptor name="clave" nullable="false" default-fetch="true"
column="CLAVE" jdbc-type="VARCHAR"/>
		<field-descriptor name="fallidos" default-fetch="true"
column="FALLIDOS" jdbc-type="INTEGER"/>
		<field-descriptor name="bloqueado" default-fetch="true"
column="BLOQUEADO" jdbc-type="CHAR"/>
		<field-descriptor name="admin" nullable="false" default-fetch="true"
column="ADMIN" jdbc-type="CHAR"/>
                <reference-descriptor name="tBLGRUPOS"
class-ref="serco.dao.usuarios.Grupos" auto-update="false"
auto-delete="false">
			<foreignkey field-ref="iDGRUPO"/>
		</reference-descriptor>
       		<reference-descriptor name="personas"
class-ref="serco.dao.personas.Personas" auto-update="false"
auto-delete="false">
			<foreignkey field-ref="idPersona"/>
			<foreignkey field-ref="idOrganizacion"/>
			<foreignkey field-ref="idCentro"/>
		</reference-descriptor>
                <collection-descriptor name="tBLPERMISOSList" 
element-class-ref="serco.dao.usuarios.Permisos" auto-retrieve="true"
auto-update="true" auto-delete="true">
			<inverse-foreignkey field-ref="iDUSUARIO"/>
			<inverse-foreignkey field-ref="idPersona"/>
			<inverse-foreignkey field-ref="idOrganizacion"/>
			<inverse-foreignkey field-ref="idCentro"/>
		</collection-descriptor>
	</class-descriptor>

The Value Object are:

public class Operaciones extends ValueObject implements Serializable {
    private int iDOPERACION;
    private String aCTIVA;
    private String dESCRIPCION;
    private String uRL;
    public Vector plantillasOPERACIONESList = new Vector();
    public Vector tBLPERMISOSList = new Vector();

public class Permisos extends ValueObject implements Serializable {
    private int iDOPERACION;
    private int iDPERMISO;
    private int iDUSUARIO;
    private int idCentro;
    private int idOrganizacion;
    private int idPersona;
    public Operaciones tBLOPERACIONES;
    public Usuarios tBLUSUARIOS;

public class Usuarios extends ValueObject implements Serializable {
    private int iDUSUARIO;
    private int idCentro;
    private int idOrganizacion;
    private int idPersona;
    private int iDGRUPO;
    private String bloqueado;
    private String clave;
    private int fallidos;
    private String nombreusuario;
    public Personas personas;
    public Grupos tBLGRUPOS;
    public Vector tBLPERMISOSList = new Vector();
    private String admin;

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Problem with load Collection

Posted by Thomas Dudziak <to...@gmail.com>.
Are you sure that there are really rows in the Permisos table ? You
specified auto-update="false" for the collection which means that you
have to handle the linking yourself. It might be that there are no
objects in the Permisos table, or that the foreignkey values there do
not match the primarykey values in the Operaciones table.

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org