-->
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.  [ 2 posts ] 
Author Message
 Post subject: Is there anything with using order-by="text asc" with mysql5
PostPosted: Sun Jun 07, 2009 5:34 am 
Regular
Regular

Joined: Tue May 12, 2009 6:08 am
Posts: 92
Is there anything with using order-by="text asc" with mysql5?

Is "text" some sort of keyword where it can't be used as a column name?

Here is the error I get:
Code:
RN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1054, SQLState: 42S22
WARN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1054, SQLState: 42S22
ERROR [org.hibernate.util.JDBCExceptionReporter] - Unknown column 'answers0_.text' in 'order clause'
ERROR [org.hibernate.util.JDBCExceptionReporter] - Unknown column 'answers0_.text' in 'order clause'


Here is the culprit:
Code:
          <bag name="expectedAnswers" inverse="true" cascade="all-delete-orphan" order-by="text asc" lazy="false">
              <key column="question_id" not-null="true"/>
              <one-to-many class="jobprep.domain.finite.QuestionKeyword" />
          </bag>


Just change the column, or is there a nice workaround?

Oh, and yes, there is definitely a column named "text" before you ask...


Top
 Profile  
 
 Post subject: Re: Is there anything with using order-by="text asc" with mysql5
PostPosted: Sun Jun 07, 2009 5:47 am 
Regular
Regular

Joined: Tue May 12, 2009 6:08 am
Posts: 92
Oh, here is the generated sql. Running this in phpMyAdmin poses a problem too. Oddly enough, if I take out the "order by answers0_.text asc" part, the query works. What could be wrong? :/

Code:
    select
        answers0_.question_result_id as question1_3_,
        answers0_.answer_id as answer2_3_,
        questionke1_.answer_id as answer1_4_0_,
        questionke1_.question_id as question3_4_0_,
        questionke1_.originality as original4_4_0_,
        questionke1_.text as text4_0_,
        questionke1_.loose_matching as loose6_4_0_,
        questionke1_.type as type4_0_,
        question2_.question_id as question1_5_1_,
        question2_.task_id as task3_5_1_,
        question2_.text as text5_1_,
        question2_.ordering as ordering5_1_,
        question2_.success_message as success6_5_1_,
        question2_.engine_type as engine7_5_1_,
        question2_.minimum_number_of_keywords as minimum8_5_1_,
        question2_.minimum_number_of_words as minimum9_5_1_,
        question2_.minimum_number_of_words_for_first_attempt as minimum10_5_1_,
        question2_.minimum_number_of_sentences as minimum11_5_1_,
        question2_.type as type5_1_,
        task3_.task_id as task1_8_2_,
        task3_.name as name8_2_,
        task3_.ordering as ordering8_2_,
        task3_.module_id as module4_8_2_
    from
        question_result_to_answer answers0_
    left outer join
        answer questionke1_
            on answers0_.answer_id=questionke1_.answer_id
    inner join
        question question2_
            on questionke1_.question_id=question2_.question_id
    left outer join
        task task3_
            on question2_.task_id=task3_.task_id
    where
        answers0_.question_result_id=1
    order by
        answers0_.text asc


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

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.