-->
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: Unable to parse order-by fragment
PostPosted: Thu Sep 05, 2013 6:30 pm 
Newbie

Joined: Fri Sep 03, 2010 6:27 pm
Posts: 8
Location: Munich
This issue has been reported in a different context before. Here's my problem:
I have the following annotation:

Code:
@org.hibernate.annotations.OrderBy(clause="case when displayOrder is null then 1 else null end, displayOrder, displayOrder, category_name")


which works well in hibernate-annotations 3.4.0.GA and with a MySQL DB.
After upgrading to 3.5.6-Final (I've also tried 3.5.0.Final) I'm getting the exception "Failed to create session factory: Unable to parse order-by fragment".

The root cause appears to be the 'case' keyword:

Code:
00:09:58,067 TRACE sql.ordering.antlr.OrderByFragmentParser:67 - -> orderByFragment
00:09:58,070 TRACE sql.ordering.antlr.OrderByFragmentParser:82 - orderByFragment
00:09:58,071 TRACE sql.ordering.antlr.OrderByFragmentParser:67 - ---> sortSpecification
00:09:58,071 TRACE sql.ordering.antlr.OrderByFragmentParser:82 - sortSpecification
00:09:58,072 TRACE sql.ordering.antlr.OrderByFragmentParser:67 - -----> sortKey
00:09:58,073 TRACE sql.ordering.antlr.OrderByFragmentParser:82 - sortKey
00:09:58,074 TRACE sql.ordering.antlr.OrderByFragmentParser:67 - -------> expression
00:09:58,074 TRACE sql.ordering.antlr.OrderByFragmentParser:82 - expression
line 1:1: unexpected token: case
00:09:58,080 TRACE sql.ordering.antlr.OrderByFragmentParser:75 - <------- expression
00:09:58,089 TRACE sql.ordering.antlr.OrderByFragmentParser:75 - <----- sortKey
00:09:58,091 TRACE sql.ordering.antlr.OrderByFragmentParser:75 - <--- sortSpecification
00:09:58,092 TRACE sql.ordering.antlr.OrderByFragmentParser:75 - <- orderByFragment


Is there any way out of this? I need this order statement to get null values sorted at the end instead of at the beginning.
Is there a reason why 'case' is not accepted any more,or should I file a bug?

Thank you for any advise.


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.