Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:hibernate3.1.2
Name and version of the database you are using:SQL 2000
Code:
DetachedCriteria detachedCriteria = DetachedCriteria
.forClass(SysOrganization.class,"sysorg");
detachedCriteria.createAlias("OOrgUsers", "ru");
detachedCriteria.createAlias("ru.sysUser", "sysuser");
if (state == null || state.equalsIgnoreCase("true")){
detachedCriteria.add(Restrictions.eq("sysorg.POrgCode", porgCode));
}
else{
detachedCriteria.add(Restrictions.eq("sysorg.orgCode", new Long(porgCode)));
}
detachedCriteria.add(Restrictions.ne("sysorg.orgFlag", new Integer(0)));
detachedCriteria.addOrder(Order.asc("sysorg.orgSortId"));
the sql is:
Code:
select top 10 this_.ORG_CODE as ORG1_1_2_, this_.P_ORG_CODE as P2_1_2_, this_.ORG_NAME as ORG3_1_2_,
this_.ORG_ABNAME as ORG4_1_2_, this_.ORG_PHONE as ORG5_1_2_, this_.ORG_MEMO as ORG6_1_2_, this_.ORG_FLAG as ORG7_1_2_,
this_.ORG_SORT_ID as ORG8_1_2_,
ru1_.OID as OID2_0_, ru1_.ORG_CODE as ORG2_2_0_, ru1_.USER_CODE as USER3_2_0_, ru1_.USER_ORG_FLAG as USER4_2_0_,
sysuser2_.USER_CODE as USER1_0_1_, sysuser2_.USER_ACCOUNT as USER2_0_1_, sysuser2_.USER_PWD as USER3_0_1_,
sysuser2_.USER_NAME as USER4_0_1_, sysuser2_.USER_MEMO as USER5_0_1_, sysuser2_.USER_FLAG as USER6_0_1_,
sysuser2_.USER_SORT_ID as USER7_0_1_ from EcodeWFM.dbo.SYS_ORGANIZATION this_
inner join EcodeWFM.dbo.O_ORG_USER ru1_ on this_.ORG_CODE=ru1_.ORG_CODE inner join EcodeWFM.dbo.SYS_USER sysuser2_ on ru1_.USER_CODE=sysuser2_.USER_CODE where this_.P_ORG_CODE=1000000000 order by this_.ORG_SORT_ID asc
why it is inner join insdead of left join?how to set it to left join.