Hi,

How to use this DTOs? Can you provide me with sample example code segment?

I have a case where I need to use native query (I suppose). I have two
tables users and projects and they are linked by user_id. many users working
on a project, one-to-many from projects to users. I need to write a query
which gives me the names of all users working on every project. and another
query to get the total number of users working on every project. As far as I
know, when such queries are exectured, either using Hibernate HQL or native
query, it can not give me an object with the selected fields as its members.
We may have to construct an object with required fields explicitly. I want
to know, if it can be done automatically.

Thanks in advance.

-Shakti
On Tue, May 3, 2011 at 2:35 AM, Parker <dfpar...@gmail.com> wrote:

>  I share interest in this question.
>
> It is a classic ORM problem because tables tend to be normalized in
> practice; business logic & DAO objects can span several (many) tables for
> assembling data into useful chunks.
>
> A common use case for explicit field mapping is a data tranfer object (DTO)
> which synthesizes content from 2+ tables.
>
>
> /David
> -----------------------------------------
> On 4/22/2011 9:34 PM, Sebastian E. Ovide wrote: Hi  Shakti,
>
>  The question is, do you really need to do that ? Could you just update
> some entity ? can you be more specific in what you try to do ?
>
> On Sat, Apr 23, 2011 at 5:40 AM, Shakti Tejas <jnanart...@gmail.com>wrote:
>
>
>
>
> Hi,
>
> I want to know if there is way to map the columns selected in a native
> query to properties of an object. I read about ResultSetTransformer but what
> i understood is that it is mapped to a table in the database. My query
> consists of columns from different tables and i want to know if there is way
> to map it to an object with the same properties as that of the columns
> selected in my query.
> Any help is appreciated.
>
> Thanks in advance
>
>  Shakti Tejas
>
> --
> You received this message because you are subscribed to the Google
> Groups "Java EE (J2EE) Programming with Passion!" group.
> To post to this group, send email to
> java-ee-j2ee-programming-with-passion@googlegroups.com
> To unsubscribe from this group, send email to
> java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
> For more options, visit this group at
>
> http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en

Reply via email to