hibernate的bug: https://hibernate.atlassian.net/browse/HHH-4956
解决办法:
添加别名
select max(max_pre_nights) ,max(max_post_nights) from package_pre_post_hotel where package_id = :packageId
添加别名后可以解决问题,如果SQL中的列名不是唯一的,最好都添加别名,比如 select a.id as a_id , b.id as b_id from tablea a, tableb b;
select max(max_pre_nights) as max_pre_nights,max(max_post_nights) as max_post_nights from package_pre_post_hotel where package_id = :packageId