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