Hibernate 的session.createCriteria用法

Hibernate 的session.createCriteria用法

某一对象的配置文件:

< many-to-one  name ="partyTypeBean"  column ="NATT_ID"
            class
="com.paul..PartyTypeBean"  
            cascade
="none"  outer-join ="true"  not-found ="ignore"  lazy ="false" />


如果查询Party,则其关联对象PartyTypeBean是以outer-join的方式取,若要覆盖这种方式,可采用建别名的方式,如下:


Criteria criteria  =  session.createCriteria(PartyBean. class )
                                   .createAlias(
" partyTypeBean " " partyTypeBean " , Criteria.INNER_JOIN)
                                   .createAlias(
" cafBean " " cafBean " , Criteria.LEFT_JOIN)
                                   .createAlias(
" countryBean " " countryBean " , Criteria.INNER_JOIN)
                                   ;


你可能感兴趣的:(Hibernate 的session.createCriteria用法)