Pinaki,

  My makeOrderList() method looks like this:

        private List<Order> makeOrderList(
                        CriteriaBuilder builder, 
                        Root<E> root, 
                        SingularAttribute<E, ?>[] pOrderFields
        ) {
                List<Order> orderList = new LinkedList<>();
                for (SingularAttribute<E, ?> attribute: pOrderFields) {
                        orderList.add(builder.asc(root.get(attribute)));
                }
                return orderList;
        }

I don't know how to specify an order without using the root to get the 
attribute. Am I doing something wrong in this method?

— Miguel



On May 31, 2013, at 10:46 AM, Pinaki Poddar wrote:

> Most likely it is a programming error.
> 
>>            List<Order> orderList = makeOrderList(builder,
>> qDef.from(persistentClass), orderFields);
> 
> this call causes a side-effect of CROSS JOIN which is possibly not your
> intention.  Your code has already called
>>   Root<E> from = qDef.from(persistentClass); 
> few lines earlier. While passing argument to makeOrderList(...) the second
> argument joins 'persistentClass' again.
> 
> 
> Please change the call argument to remove the side-effect and see if that
> changes anything.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -----
> Pinaki Poddar
> Chair, Apache OpenJPA Project
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/Ordering-results-obtained-through-query-by-example-tp7584043p7584058.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

-------------------------------------------

Miguel Muñoz
swingguy1...@yahoo.com
323/225-7285

-------------------------------------------

The Sun, with all those planets revolving around it and dependent on it, can 
still ripen a vine of grapes like it had nothing else to do in the world.

  -- Galileo

-------------------------------------------

There are seven sins in the world.
    Wealth without work.
    Pleasure without conscience.
    Knowledge without character.
    Commerce without morality.
    Science without humanity.
    Worship without sacrifice.
    Politics without principle. 

  -- Mohandas Gandhi

-------------------------------------------

If tyranny and oppression come to this land, it will come in the guise of 
fighting a foreign enemy.

  -- James Madison


Reply via email to