[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Why is getResultList() grouped by Class even when ORDER BY is used?
|
Hi!
I am in need to fetch a Instance of an inherited Class with the largest
inventoryId from my Database. Therefore i generate the following query:
SELECT vmc FROM VendingmachineComponent vmc ORDER BY vmc.inventoryId DESC
This is my class hierarchy:
I've got a "VendingmachineComponent" Class which is the Superclass of
"VendingmachineComponentBasemachine" as well as
"VendingmachineComponentQuick".
My inheritance strategy is "Inheritance(strategy=InheritanceType.JOINED)"
Every time i read the result list list, the Objects aren't ordered by their
inventoryId, instead they are ordered by their Class and then by
inventoryId.
This is wat i get from getResultList():
VendingmachineComponentBasemachine inventoryId: 10
VendingmachineComponentBasemachine inventoryId: 8
VendingmachineComponentBasemachine inventoryId: 7
VendingmachineComponentQuick inventoryId: 15
VendingmachineComponentQuick inventoryId: 14
VendingmachineComponentQuick inventoryId: 9
This is what i want to get:
VendingmachineComponentQuick inventoryId: 15
VendingmachineComponentQuick inventoryId: 14
VendingmachineComponentBasemachine inventoryId: 10
VendingmachineComponentQuick inventoryId: 9
VendingmachineComponentBasemachine inventoryId: 8
VendingmachineComponentBasemachine inventoryId: 7
Is this the normal behaviour?
What can i do to get the object with the highest inventoryId value
regardless of what type of VendingmachineComponent it is?
Thanks in advance for your Help!
christian
--
View this message in context: http://www.nabble.com/Why-is-getResultList%28%29-grouped-by-Class-even-when-ORDER-BY-is-used--tp20937838p20937838.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.