Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Data from multiple table

You can have an ordinary class that represents your desired structure, and then use it for transforming the results of the JPQL, for example you can use an object Temp who has a constructor that takes the arguments you want in the resultset; then you can use some thing like:

SELECT new com.company.product.Temp(a.i,a.j,a.k,b.l,b.m,c.n,c.p) FROM A a JOIN B b JOIN C c WHERE a.z=b.z  AND a.k=c.p);

In Hibernate, there is some thing called Transformer API that lets you configure the transformer object for each query instead of using this constructor approach.

Eclipse Link also have a similar API, but I haven't used it so far, so I cannot comment on whether that will be useful to you in this scenario.

Regards,
Samba



On Tue, Aug 10, 2010 at 10:54 AM, Tanujit Chowdhury <chowdhury.tanujit@xxxxxxxxx> wrote:
Hi,
I am using EclipseLink 1.0 and SQL Server.
I am pretty new to the JPQL and EclipseLink.

I have two tables A and B. I have execute a query like :

select a,x, b.y from A x, B y where a.z=b.z

How to write its equivalent JPQL and what would be its output object? In general when we execute JPQL it returns an Object/list of Object that represents a database table. In this case it is mixed.

--
Tanujit Chowdhury

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top