[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Data from multiple table
|
Hi Tanujit,
JPQL and JPA are intended to be used in an Object Relational context.
i.e. The idea is you map the data in your database to Java Objects and
operate on those java objects. How you write your JPQL depends entirely on how
you have those objects mapped.
For instance, you might map an AObject for your A table and a BObject for your B
table. You might then create an OneToOneMapping using a.z and b.z as the
JoinColumns. In that case, your JPQL would look something like this:
select a.xAttribute, b.yAttribute from AObject a join a.b b
That's just an example, there are lots of ways to map these kinds of thing. The
key here is that to make best use of JPA your tables should be represented as
objects and it does not necessarily make sense to map in such a way that there
is a single class that represents a single table.
-Tom
Tanujit Chowdhury 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