-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Exception in Order By on properties of Many-To-One attribute
PostPosted: Thu Mar 17, 2005 10:02 pm 
Newbie

Joined: Wed Mar 02, 2005 7:41 pm
Posts: 7
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:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.