Re: How to?

From: Sid Ferreira (sid.gb..mail.com)
Date: Fri Jan 16 2009 - 07:41:04 EST

  • Next message: Aristedes Maniatis: "Re: How to?"

    I want select all users belonging to client number 7in the user table
    client's id (CD_CLIENTE) is a Primary Foreign Key.

    On Fri, Jan 16, 2009 at 10:30 AM, Andrus Adamchik <andru..bjectstyle.org>wrote:

    > Then I don't understand what you are trying to fetch. Could you explain the
    > meaning of the query?
    >
    > Thanks,
    > Andrus
    >
    >
    > On Jan 16, 2009, at 2:17 PM, Sid Ferreira wrote:
    >
    > select1 = new SelectQuery(UsuariosClientes.class);
    >>
    >> select1.andQualifier(ExpressionFactory.matchDbExp(UsuariosClientes.CD_CLIENTE_PK_COLUMN,
    >> this.cdCliente));
    >>
    >> Didn't worked...
    >>
    >> On Fri, Jan 16, 2009 at 8:38 AM, Andrus Adamchik <andru..bjectstyle.org
    >> >wrote:
    >>
    >> Hi Sid,
    >>>
    >>> Two possible approaches:
    >>>
    >>> 1. (preferred) matching on a related object. That's the point of ORM
    >>> after
    >>> all to work with objects, not DB keys.
    >>>
    >>> 2. If this is not possible, you can use the same approach as with PK
    >>> matching. The only difference is that there's no generated constant for
    >>> the
    >>> FK, so you'd specify a string column name. E.g., continuing with your
    >>> code
    >>> example:
    >>>
    >>> select1.andQualifier(ExpressionFactory.matchDbExp("fk_column", value));
    >>>
    >>> Andrus
    >>>
    >>>
    >>> On Jan 15, 2009, at 9:34 PM, Sid Ferreira wrote:
    >>>
    >>> qualifier1 =
    >>>
    >>>> ExpressionFactory.matchExp("db:"+UsuariosClientes.CD_CLIENTE_PK_COLUMN,
    >>>> getCdCliente());select1 = new SelectQuery(UsuariosClientes.class,
    >>>> qualifier1);
    >>>>
    >>>> How to make a select using a PFK (primary key AND foreign key) field?
    >>>>
    >>>> --
    >>>> Sidney G B Ferreira
    >>>> Desenvolvedor Web - Tibox Innovations
    >>>>
    >>>>
    >>>
    >>>
    >>
    >> --
    >> Sidney G B Ferreira
    >> Desenvolvedor Web - Tibox Innovations
    >>
    >
    >

    -- 
    Sidney G B Ferreira
    Desenvolvedor Web - Tibox Innovations
    



    This archive was generated by hypermail 2.0.0 : Fri Jan 16 2009 - 07:41:37 EST