내가 최대 절전 모드에서 데이터베이스 쿼리를 최적화하려고 곳에서 외래 키를 사용하는 경우 불필요한 피하면 가입,하지만 난 차단기를 발견최대 절전 모드 - 절
<class name="SupportedLanguageVO" table="AR_SUPPORTED_LANG" >
<cache usage="read-only"/>
<id name="Id" type="java.math.BigInteger">
<column name="ID" sql-type="NUMBER(20)" not-null="true"/>
<generator class="assigned"/>
</id>
<property name="OrderSeq" type="java.math.BigInteger">
<column name="ORDER_SEQ" sql-type="NUMBER(20)" not-null="true"/>
</property>
<many-to-one name="Country" class="CountryVO" column="CTRY_CD_ID" cascade="none" >
<many-to-one name="Language" class="LanguageVO" column="LANG_CD" cascade="none" >
</class>
국가의 기본 키가 CTRY_CD_ID
입니다. 나는 다음과 같은 기준
Criteria crit = m_Session.createCriteria(SupportedLanguageVO.class);
crit.createCriteria("Country").add(Restrictions.eq("_CountryCode", p_countrycode));
crit.addOrder(Order.asc("OrderSeq"));
을 실행하면 그 최대 절전 모드는 CTRY과 AR_SUPPORTED_LANG 테이블을 조인 볼 수 있습니다. 왜? 내가 첫 번째 쿼리를 실행하는 데 최대 절전 모드로 강제 할 수 오히려
select * from AR_SUPPORTED_LANG inner join ctry .... where ctry_cd_id=?
보다
select * from AR_SUPPORTED_LANG where ctry_cd_id=?
SQL을 실행하는 것이 더 있을까?
Unfortunatelly 개체가 없습니다. 국가 코드 :-( – HamoriZ
국가 코드가 국가 테이블의 ID입니까? 그렇다면 최대 절전 모드에서 개체를로드하지 않고 수동으로 만들면 최대 절전 모드가됩니다. db, id 필드를 채우는 한 (예 : crit.add (Restrictions.eq ("Country", new CountryVO (p_country_code));) – Thierry