내가 한 거래최대 절전 모드 : HQL은 데이터를로드하지 않지만, 기준은
(0)Transaction begins
(1)Insert A into myTable
(2)Load all data from myTable using HQL #-> A is not loaded
(3)Load all data from myTable using Criteria #-> A is loaded
(4)Transaction ends
에 다음과 같은 지침을하지만 (2)
및 (3)
를 교환하는 경우, 두 경우 모두 잘하고 A
가로드를 수행합니다.
이 문제의 원인은 무엇입니까?
상세 사항 : HQL 문을 실행하지 않는 반면 여기 코드입니다 내가
@Transcational
myFunction(){
//I have A inserted into myTable and the rest...
SQLQuery crit = (SQLQuery) getSession().createSQLQuery("select * from myTable ");
ArrayList<PatternHeader> ls = (ArrayList<PatternHeader>)crit.list(); //There is no trace of A
Criteria cr = getSession().createCriteria(MyTable.class);
ArrayList<PatternHeader> crls = (ArrayList<PatternHeader>)cr.list(); // A is loaded as well
}
실제로 SQL 쿼리는 HQL 쿼리가 아닙니다. – Atropo
그래, 알아. 사실 질의는 약간 달랐지 만, 간단하게하기 위해 질의를 변경했습니다. –