About Question enthuware.oce-jpad.v6.2.580 :
Moderator: admin
-
- Posts: 7
- Joined: Fri Oct 18, 2013 4:02 am
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.580 :
Hi Paul,
I use EclipseLink. You mean that is something wrong with the implementation ?
Thanks,
Liviu
I use EclipseLink. You mean that is something wrong with the implementation ?
Thanks,
Liviu
-
- Site Admin
- Posts: 10043
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.580 :
That is certainly a possibility. We have seen several cases where implementation does not exactly comply with the specification. Let me confirm with the author on which implementation and version this was tested because there can differences because of versions as well.cliviu wrote:Hi Paul,
I use EclipseLink. You mean that is something wrong with the implementation ?
Thanks,
Liviu
I see that the explanation contains the query that gets generated, which aligns well with the API description. So I suspect that what you see is probably because of non compliant behavior.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 7
- Joined: Fri Oct 18, 2013 4:02 am
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.580 :
Hi Paul,
With JBoss I have 12 results , sounds right 2X6 ... with Eclipse Link only 2.
Nevertheless , in the explanation is given 2X3 results, which is correct only when the two users share the same three orders.
Please correct me if I'm wrong ...
Thanks,
Liviu
With JBoss I have 12 results , sounds right 2X6 ... with Eclipse Link only 2.
Nevertheless , in the explanation is given 2X3 results, which is correct only when the two users share the same three orders.
Please correct me if I'm wrong ...
Thanks,
Liviu
-
- Site Admin
- Posts: 10043
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.580 :
Yes, you are right. It should be 12.
Paul.
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 11
- Joined: Fri Jan 23, 2015 5:05 am
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.580 :
I'm a bit confused by the following explanation:
"2. In this case, you cannot join Customer with CustOrder (though the reverse is possible) because Customer does not have a Collection of CustOrders. (It is given in the problem statement that CustOrder to Customer is a unidirectional many to one relationship.)"
My SQL skills are probably a bit outdated, but in pure SQL, isn't it possible to join in either direction even on a unidirectional relationship?
In other words, can't I do
SELECT DISTINCT *
FROM Customer c
INNER JOIN CustOrder;
when only CustOrder has FK references to Customer?
Over at http://www.w3schools.com/sql/trysql.asp ... select_all I just tried:
SELECT DISTINCT *
FROM Customers c
JOIN Orders o ON o.CustomerID = c.CustomerID;
This worked fine, even though Orders is the owning side (FK from Orders pointing to PK of Customers)
If this is possible in MySQL, why does CriteryQuery [edit: replaced JPQL with CriteriaQuery, as this is what the exam question is about] care in which direction you specify the FROM and JOIN?
"2. In this case, you cannot join Customer with CustOrder (though the reverse is possible) because Customer does not have a Collection of CustOrders. (It is given in the problem statement that CustOrder to Customer is a unidirectional many to one relationship.)"
My SQL skills are probably a bit outdated, but in pure SQL, isn't it possible to join in either direction even on a unidirectional relationship?
In other words, can't I do
SELECT DISTINCT *
FROM Customer c
INNER JOIN CustOrder;
when only CustOrder has FK references to Customer?
Over at http://www.w3schools.com/sql/trysql.asp ... select_all I just tried:
SELECT DISTINCT *
FROM Customers c
JOIN Orders o ON o.CustomerID = c.CustomerID;
This worked fine, even though Orders is the owning side (FK from Orders pointing to PK of Customers)
If this is possible in MySQL, why does CriteryQuery [edit: replaced JPQL with CriteriaQuery, as this is what the exam question is about] care in which direction you specify the FROM and JOIN?
Last edited by swiss-chris on Wed Feb 04, 2015 12:23 pm, edited 1 time in total.
-
- Site Admin
- Posts: 10043
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.580 :
Yes, it is certainly possible with pure sql but not with JPQL. JQPL traverses the object graph and builds sql querries off of that. So if there is no variable from A to B in A, it can't traverse from A to B.
If you like our products and services, please help us by posting your review here.
-
- Posts: 11
- Joined: Fri Jan 23, 2015 5:05 am
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.580 :
Thanks for your reply!admin wrote:Yes, it is certainly possible with pure sql but not with JPQL. JQPL traverses the object graph and builds sql querries off of that. So if there is no variable from A to B in A, it can't traverse from A to B.
I just realized that I meant CriteriaQuery, not JPQL. How does it work with CriteriaQuery? Where can I find this behavior documented in the specification?
-
- Site Admin
- Posts: 10043
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.580 :
Same thing with CriterialQuery as well. You can go through the specification for more details.
If you like our products and services, please help us by posting your review here.
-
- Posts: 39
- Joined: Thu Jan 29, 2015 4:49 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.580 :
I think the explanation for 4th option has to go to the first one.
-
- Site Admin
- Posts: 10043
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.580 :
It looks ok. Explanation to option 4 gives 2 reasons why it is incorrect. Option 1 is correct anyway.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 22 guests