Hi,
I have a WorkRequest class which has a property equipment and it is many-to-one to Equipment class. When I try to get WorkRequest records (without order by clause) for a particular equipment.type, it works fine.
But when I add an Order By clause on equipment.name, it gives me a NullPointerException. Basically, I need to order all the work requests of equipment type = "Switch" and order these work requests by Equipment Name.
Order by clause works fine with properties in WorkRequest class and which are not foreign keys to other tables.
Am I missing something ? Java code is listed below.
Thanks
JP
Hibernate Version : 2.1.8
Code between sessionFactory.openSession() and session.close():
Criteria c = hibernateSession.createCriteria(WorkRequest.class); c.createAlias("equipment", "equip"); c.add(Expression.eq("equip.type", "Switch")); c.addOrder(Order.asc("equip.name")); List l1 = c.list();
Full stack trace of any exception that occurs:
Database : Oracle 9i :
The generated SQL (show_sql=true): None
Debug level Hibernate log excerpt:
|