Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Why is getResultList() grouped by Class even when ORDER BY is used?

Hi!

If someone is seeking a solution to a similar problem, the following might
help:

I've now mapped a completely new class named
VendingmachineComponentNumberingHelper to the same table in the DB, but this
new class VendingmachineComponentNumberingHelper doesn't have any
relationship to the original Class-Hierarchy VendingmachineComponent. It
also doesn't have any setters and i do only use it for getting the next
inventoryId. Here's an example of that class:

@Entity
@Table(name = "vendingmachinecomponent")
public class VendingmachineComponentNumberingHelper implements Serializable
{
    private static final long serialVersionUID = 1L;
    
    @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "vendingmachinecomponent_rowid", nullable = false)
    private Integer rowid;
        
    @Column(name = "vendingmachinecomponent_inventoryid")
    private Integer inventoryId;
    

    public VendingmachineComponentNumberingHelper() {
       
    }

    public VendingmachineComponentNumberingHelper(Integer
vendingmachinecomponentRowid) {
        this();
        this.rowid = vendingmachinecomponentRowid;
    }

    public Integer getInventoryId() {
        return inventoryId;
    }

    public Integer getRowid() {
        return rowid;
    }
}

With that new class without any inheritance the ordering works as expected.
A somewhat dirty solution, but it works.

If anyone of you has got a better solution, please post!

Best regards,
  christian
-- 
View this message in context: http://www.nabble.com/Why-is-getResultList%28%29-grouped-by-Class-even-when-ORDER-BY-is-used--tp20937838p20952358.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top