This is a migrated thread and some comments may be shown as answers.

Why does this query work??

2 Answers 35 Views
OQL (OQL specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
gmendez
Top achievements
Rank 1
gmendez asked on 31 Jul 2009, 05:46 PM
Hello everybody, I recognize this question might sound odd.
I was trying get a set of products (ArticuloEmpresa) for a given company (EmpresaID) where there exists at least one order (Pedido) for each product.
So, products are ArticuloEmpresaExtent and orders are PedidoExtent.
I tryed this query and it works ok. But as I was just testing I would expect it to return all the "PedidoExtent" fields too as it was SQL.

SELECT * FROM ArticuloEmpresaExtent AS x,
                                PedidoExtent as y
WHERE  x.EmpresaID = "640d6df6-994a-4173-9b31-473eb5b5d76f" AND
y.Articulo = x AND
 y.Estado = "AceptadoEnvio"

I was happy to see that only the "ArticuloEmpresaExtent" are retrieved, but I don't understand why.
┬┐Can anyone explain to me please?

Best regards,

Gonzalo

2 Answers, 1 is accepted

Sort by
0
Accepted
IT-Als
Top achievements
Rank 1
answered on 03 Aug 2009, 01:56 PM
Hi gmendez,

OpenAccess (OA) is querying to get objects of a specific type.. In your case the first type you listed in the SELECT.

If the "products" and "orders" are associated..example: In the Order class you have a list of <Product> instances. Then, you can select the Order instances and for each Order instance use the property "Products" to navigate the products...  like order.Products

The result of an OQL query always is of a specific class type.

Regards

Henrik


0
gmendez
Top achievements
Rank 1
answered on 05 Aug 2009, 01:20 PM
Hello Henrik, very useful explanation.
Thanks a lot.
Best regards,

Gonzalo
Tags
OQL (OQL specific questions)
Asked by
gmendez
Top achievements
Rank 1
Answers by
IT-Als
Top achievements
Rank 1
gmendez
Top achievements
Rank 1
Share this question
or