query specified join fetching, but the owner of the fetched association was not

from TSignpartDTO Z left join fetch  Z.tbTProjectDTO B

  <many-to-one
   class="com.sinovatech.sunshine.signpart.model.dto.TProjectDTO"
   lazy="false" fetch="join" name="tbTProjectDTO">
   <column length="32" name="PROJECT_ID">
    <comment>项目ID</comment>
   </column>
  </many-to-one>

lazy="false" fetch="join"替换成 fetch="select"也一样

查询时出现:org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list ;

将fetch去掉后 就好了,做关联查询,可以直接加子表条件。

你可能感兴趣的:(association)