The JDBC control doesn't do that type of object mapping without some
assistance.  In your case, if I understand correctly, you have an object 'A'
which contains an object 'B' you want to be able to map a column of a
ResultSet into A.B.somevalue.

There is a way to do this but it requires a that you write a custom
ResultSetMapper.  Its not much code and you can map the ResultSet into the
result object(s) in any way you want.

Take a look at:
http://beehive.apache.org/docs/nightly/system-controls/jdbc/guide.html#Creating+Customer+Result+Set+Mappers

This gives an overview of what you will need to do.  Take a look and let me
know if you have questions.

  - Chad




On 2/1/06, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:
>
> Hi Chad
> Thanks for the reply. But my question was more about the mapping of the
> results into objects rather than the sql itself.
> So my question was that  if I have a object inside and object  how can I
> make the some resultset columns ( assuming made a join of two tables) map
> to the inner java object?
> Will the control automatically populate the inner object if it has a field
> mathcing with the column name?
> I know this works for base java objects, but I want to know it works for
> inner objects too.
>
> Let me know
> Thanks
> Madhu
>
>
>
>
>
> Chad Schoettger <[EMAIL PROTECTED]>
> 02/01/2006 10:46 AM
> Please respond to
> "Beehive Users" <[email protected]>
>
>
> To
> Beehive Users <[email protected]>
> cc
>
> Subject
> Re: JDBC Control question
>
>
>
>
>
>
> Hi Madhu,
>
> The JDBC control will pass your SQL statement to the JDBC driver.  Any
> valid
> SQL statement can be used to do your queries.  If the SQL statement is not
> valid you will get an SQLException from the JDBC driver.  So you should be
> able to use either of the statments below assuming they provide the
> functionality you need.  Let me know if this doesn't answer you question.
>
> - Chad
>
> On 2/1/06, [EMAIL PROTECTED] <
> [EMAIL PROTECTED]> wrote:
> >
> > Hi
> > I have a ProjectVO which has ClientVO inside it. And my Project table
> has
> > ClientID as foreign key referencing Client(ClientID).
> >
> > My question is can i write a query in the control like:
> > How do i write the query so that it get the clientId into the ClientVO
> > inside ProjectVO? My question is can i do something like this:
> >
> > Select ProjectID, ClientID from Project join Client on Project.ClientID
> =
> > Client.ClientID
> >
> > or if this doesnt work can I do:
> >
> > Select ProjectID, ClientID client.ClientID from Project join Client on
> > Project.ClientID = Client.ClientID.
> >
> > assuming that there is a getClient() method declared for client which is
> > an instance of ClientVO (I am trying to use the alias in the query for
> > ClientID)
> >
> > Please help.
> >
> > Thanks
> > Madhu
> >
>
>
>

Reply via email to