Hi,
We have upgraded Hibernate from 3.2.1 to 3.5.2.
We have a few tables on our legacy database with columns named "end"
We have a criteria that generates a select statement from multiple tables and we don't specify the "end" column directly in the criteria anywhere.
The generated sql since moving to 3.5.2 doesn't prefix the column with the alias like it did in 3.2.1...
NB. The order of the tables and columns is different between 3.2.1 and 3.5.2 but this isn't a problem and in both cases the where clause generated has the required prefix:
Generated SQL fragment from Hibernate 3.2.1:
Code:
...
currentele18_.oper as oper54_12_,
currentele18_.stream as stream54_12_,
currentele18_.end as end54_12_,
currentele18_.route as route54_12_,
currentele18_.service_op as service14_54_12_,
...
and (
currentele18_.mtype = 3
and currentele18_.start <= 'today'
and currentele18_."end" >= 'today'
)
Generated SQL fragment from Hibernate 3.5.2:
Code:
...
currentele13_.region as region54_7_,
currentele13_.despatch_to as despatch6_54_7_,
end as end54_7_,
currentele13_.optype as optype54_7_,
currentele13_.oper as oper54_7_,
...
and (
currentele13_.mtype = 3
and currentele13_.start <= 'today'
and currentele13_."end" >= 'today'
)
As you can see, the "end" column is lacking the alias prefix (this is also the case for the other tables in the same query that have an "end" column).
This apparent bug is causing the following error: java.sql.SQLException: Ambiguous column (end).
Renaming the columns is not an option.
Help please!