-->
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.  [ 4 posts ] 
Author Message
 Post subject: mysql syntax changes starting on 5.0.12
PostPosted: Sat Feb 11, 2006 10:55 pm 
Beginner
Beginner

Joined: Fri Apr 15, 2005 3:30 pm
Posts: 46
Location: Fortaleza, Brazil
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.1.2
Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
Code:
java.sql.SQLException: Unknown column 'activity0_.ACT_VELOX_INFO_ID' in 'on clause'

Name and version of the database you are using:
mysql innodb 5.0.18
The generated SQL (show_sql=true):
This is the generated query plus dummy data placed in the '? ' tags, that I tested independently of hibernate in the mysql shell, with the same error result:

Code:
select count(activity0_.activity_id) as col_0_0_ from activity
activity0_, appointment_scheduler appointmen1_ inner join
activity_velox_info activityve2_ on
activity0_.act_velox_info_id=activityve2_.act_velox_info_id inner join
activity_schedule activitysc3_ on
activity0_.act_sch_id=activitysc3_.act_sch_id inner join micro_area
microarea4_ on activityve2_.micro_area_id=microarea4_.micro_area_id
inner join micro_area_scheduler microareas5_ on
appointmen1_.appsch_id=microareas5_.appsch_id inner join micro_area
microarea6_ on microareas5_.micro_area_id=microarea6_.micro_area_id,
periods_of_day periodsofd7_ where (appointmen1_.appsch_id=1
)AND(activity0_.state<>'TRIAGE' )AND((activity0_.type='INSTALL'
)OR(activity0_.TYPE='SERVICE'
))AND(activity0_.promise_date>='2006-2-10'
)AND(activity0_.promise_date<'2006-2-11'
)AND(periodsofd7_.code='FIRST_HOUR'  and
activityve2_.period_of_day_id=periodsofd7_.period_of_day_id)AND(microarea4_.micro_area_id
IN(microarea6_.micro_area_id))AND(activitysc3_.scheduler_id=appointmen1_.appsch_id
)



Debug level Hibernate log excerpt:

Hi all,

I've been chasing a problem with queries failing with my upgrade from mysql 4.1.15 to mysql 5.0.18:

http://forum.hibernate.org/viewtopic.php?t=955350

It turns out that mysql changed their syntax:

http://dev.mysql.com/doc/refman/5.0/en/join.html

A kind person helped me out on usenet:

http://groups.google.com.br/group/maili ... 47c2e046f9

Quoting:
The solution is to use parentheses to force an order of evaluation:

FROM (tableA AS A, tableB AS B) INNER JOIN tableC AS C ON A.field1 =
C.field2

See the bulleted paragraph in
http://dev.mysql.com/doc/refman/5.0/en/join.html beginning:

"Previously, the comma operator (,) and JOIN both had the same precedence,
so the join expression t1, t2 JOIN t3 was interpreted as ((t1, t2) JOIN t3).
Now JOIN has higher precedence, so the expression is interpreted as (t1, (t2
JOIN t3)). "

I'm guessing from a hibernate viewpoint, my two options are waiting for a new dialect from hibernate or downgrading mysql to below 5.0.12 . Due to mysql's popularity, perhaps I'm missing something because my searches on this forum haven't seen this error.

iksrazal


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 10:28 am 
Beginner
Beginner

Joined: Fri Apr 15, 2005 3:30 pm
Posts: 46
Location: Fortaleza, Brazil
I searched the forums, google and jira - and couldn't find that this problem with mysql 5 and hibernate has come up before. So I created a jira to track this issue:

http://opensource2.atlassian.com/projec ... e/HHH-1480

We have a requirement to upgrade to mysql 5.0.18. Any advice would be appreciated.

iksrazal


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 2:25 pm 
Beginner
Beginner

Joined: Fri Apr 15, 2005 3:30 pm
Posts: 46
Location: Fortaleza, Brazil
Still trying to solve my problem. I can change the sql to:

Code:
from (activity
activity0_, appointment_scheduler appointmen1_)


All I did was surrond the aliases with paranthesis. That works. However, I can't find an HQL syntax that would generate that change. I tried:

Code:
FROM (Activity activity, AppointmentScheduler scheduler)


But I get:

Code:
unexpected token: (


Any ideas?
iksrazal


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 23, 2006 3:34 pm 
Newbie

Joined: Thu Feb 23, 2006 2:59 pm
Posts: 1
Location: San Francisco
I am having this same issue. The only resolution I've been able to come up with is explicitly turning off join fetching by setting "outer-join=false" on the relevant mappings (or fetch="select", which I believe is the preferred method in HB3). Globally turning off join fetching by setting max_fetch_depth = 0 is another option.

Obviously, neither of these options are ideal, as we would like to use join fetching for performance reasons.

Any guidance on how/when Hibernate will support the new MySQL join precedence rules would be appreciated.

Thanks,
Saran


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.