Message Boards
OrderFactoryUtil and sorting by a composite primary key
OrderFactoryUtil and sorting by a composite primary key
Regular Member Posts: 105 Join Date: 2/2/18 Recent PostsI'm having issues doing an "addOrder" for a DynamicQuery for a field that is part of a composite key.
My code looks like
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(MyClass.class, this.getClassLoader());
dynamicQuery.addOrder(OrderFactoryUtil.asc("primaryKey.practice"));
My service.xml for that field is
<column name="practice" db-name="Practice" type="String" primary="true" />
When executing the query, I get the following Exception
14:14:01,249 ERROR [http-bio-8080-exec-73][BasePersistenceImpl:244] Caught unexpected exception org.hibernate.QueryException
14:14:01,263 ERROR [http-bio-8080-exec-73][ClpSerializer:7376] java.lang.ClassNotFoundException: org.hibernate.QueryException
java.lang.ClassNotFoundException: org.hibernate.QueryException
Now, I've seen this before it just means that my field name above is incorrect from what is in my service.xml, but I've used the prefix primaryKey before with great results. Why can't I use this in the OrderFactoryUtil?? I am working with a Database View not a Table. I have another View and I'm able it query it with the primaryKey with no issues. What's wrong with OrderFactoryUtil??