JavaDoc
public Dictionary getLovCriteriaItems()
浠庝竴涓狶OV鍖哄煙鐨勬帶鍒跺櫒鎵懼埌涓鴻LOV璁劇疆鐨勮鍔ㄧ殑鏍囧噯鏄犲皠鐨勬墍鏈夊箋傝繑鍥炵殑Dictionary 浠OV region鐨処tem浣滀負Key銆?/p>
public Dictionary getLovCriteriaViewAttrNames()
浠嶭OV region鐨勬帶鍒跺櫒鎵懼埌璇OV鐨勮鍔ㄧ殑鏍囧噯鏄犲皠鐨勬墍鏈夊箋傝繑鍥炵殑dictionary 鏄互LOV region鐨刬tem鐨勮鍥懼睘鎬у悕涓簁ey鐨勩?/p>
娉ㄦ剰錛岃繖涓や釜鏂規硶蹇呴』鍐欏湪LOV region鐨勬帶鍒跺櫒閲岋細
鍦˙ase Page涓婅幏寰桳ov鏄惁瑙﹀彂錛屼嬌鐢╬ageContext .isLovEvent()錛屽彲浠ラ氳繃pageContext.getLovInputSourceId()鑾峰緱瑙﹀彂璇ヤ簨浠剁殑欏甸潰涓奓ovInput鐨勫悕縐般?/p>
鍙互閫氳繃pageContext.getLovResultsFromSession(lovInputSourceId)鑾峰緱Lov鐨勮繑鍥炲鹼紝鐢ㄤ竴涓狧ashTable鏉ヤ紶閫掋?/p>
getRowCount
()
Counts the total number of rows in this row set.
璁$畻榪欎釜琛岄泦鐨勮鎬繪暟
This method retrieves all rows from the View Object by executing the View Object's query and then callingnext() until the last row is retrieved. Thus, since it iterates through the View Object one record at a time, this method may be slow.
璇ユ柟娉曢氳繃鎵ц瑙嗗浘瀵硅薄鐨勬煡璇粠瑙嗗浘瀵硅薄涓幏鍙栨墍鏈夎錛岀劧鍚庤皟鐢?span>next()鐩村埌鏈鍚庝竴琛岃璋冪敤銆備簬鏄紝鐢變簬瀹冮氳繃瑙嗗浘瀵硅薄涓嬈¤凱浠d竴鏉¤褰曪紝鍥犳璇ユ柟娉曟槸姣旇緝鎱㈢殑銆?/span>
If you are working with a large number of rows, or if your application demands a fast response, usegetEstimatedRowCount
to obtain a quicker count.
濡傛灉浣犳搷浣滀竴澶у爢琛岋紝鎴栬呬綘鐨勫簲鐢ㄩ渶瑕佷竴涓揩閫熺殑鍝嶅簲錛屼嬌鐢?span>getEstimatedRowCount
鑾峰緱涓涓洿蹇殑鏁伴噺銆?/span>
The following sample code uses getRowCount() to set up separate iterators for even numbered and odd numbered rows:
涓嬮潰鐨勪唬鐮佷嬌鐢?tt>getRowCount()涓哄熀鏁板拰鍋舵暟琛屽垱绔嬬嫭绔嬬殑榪唬鍣ㄣ?/tt>
// Default iterator gets even-numbered rows.
// Second iterator gets odd-numbered rows.
long nRows = vo.getRowCount();
String msg = "";
for (int i = 0; i < nRows; i +=2) {
// Get and set row index values relative to a range.
// Index of first row = 0.
vo.setCurrentRowAtRangeIndex(i);
Row currRow = vo.getCurrentRow();
msg = " Default iterator (even): " + vo.getRangeIndexOf(currRow);
printRow(currRow, msg);
secondIter.setCurrentRowAtRangeIndex(i + 1);
currRow = secondIter.getCurrentRow();
msg = " Second iterator (odd): " + vo.getRangeIndexOf(currRow);
printRow(secondIter.getCurrentRow(), msg);
}
getRowCountInRange
()
Counts the rows actually in the range.
璁$畻鑼冨洿鍐呯殑瀹為檯琛屾暟
getRowCountInRange
()
錛?span style="font-family: Calibri; ">int
Gets the size of the current
RowSet's
range鑾峰緱褰撳墠RowSet錛堣褰曢泦錛夌殑鑼冨洿澶у皬銆?/p>
getFetchedRowCount
()
錛?span style="font-family: Calibri; ">int
Counts the number of rows fetched from the JDBC result set.
璁$畻浠?span style="font-family: Calibri; ">JDBC緇撴灉闆嗘姄鍙栫殑琛屾暟銆?/p>
This method delegates to the default RowSetIterator.
This method can be used to determine whether the View Object has read all the rows from the cursor. For example, getEstimatedRowCount
returns an equivalent of count(*) on the View Object. ThegetFetchedRowCount() method returns the count of rows already fetched. If getFetchedRowCount() returns a value less than getEstimatedRowCount(), then the View Object has not read all rows from the cursor.
璇ユ柟娉曡鐢ㄤ簬紜畾瑙嗗浘瀵硅薄鏄惁浠庢父鏍囦腑璇誨彇鎵鏈夌殑琛屻備緥濡傦紝getEstimatedRowCount
榪斿洖瑙嗗浘瀵硅薄涓奵ount(*)鐩哥瓑鐨勯噺銆?tt>getFetchedRowCount()鏂規硶鍙繑鍥炲凡緇忔姄鍙栫殑琛屾暟銆傚鏋?span>getFetchedRowCount()榪斿洖鐨勫煎皬浜巊etEstimatedRowCount()錛岄偅涔堣鍥懼璞℃病鏈変粠娓告爣涓鍒版墍鏈夎銆?/span>
Makes an estimated count of the rows in this row set.
This method estimates the number of rows in the row count by calling getQueryHitCount (which performs a SELECT COUNT (*) FROM table). Internal logic in Business Components for Java keeps the EstimatedRowCount up-to-date as rows are inserted and removed. Thus, after the first call to this method, it can return the estimated count quickly.
For example:
// Get the rowcount again because of deleted or inserted row
rowCount = (int) iter.getRowSet().getEstimatedRowCount();
If you are working with a large number of rows, or if your application demands a fast response, use this method instead ofgetRowCount.
Note however, that this method might not be as accurate as getRowCount().
娉ㄦ剰錛氫絾鏄紝榪欎釜鏂規硶鍙兘娌℃湁getRowCount鍑嗙‘銆?/span>
To test whether the View Object has read all the rows from the cursor, you can use getEstimatedRowCount() in conjunction with getFetchedRowCount(). For example, getEstimatedRowCount() returns an equivalent of count(*) on the View Object. The getFetchedRowCount method returns the count of rows already fetched. If getFetchedRowCount() returns a value less than getEstimatedRowCount(), then the View Object has not read all rows from the cursor.
getFetchSize
()
Gets the row pre-fetch size.
鑾峰緱琛岀殑棰勫厛鎶撳彇澶у皬
The framework will use this value to set the JDBC row pre-fetch size. Note that the row pre-fetch size has performance ramifications. A larger fetch size is more expensive in terms of memory usage than a smaller size. The default fetch size is 1 row.
妗嗘灦灝嗕嬌鐢ㄨ繖涓煎幓璁懼畾JDBC琛岄鎶撳彇澶у皬銆傛敞鎰忚棰勬姄鍙栧ぇ灝忓獎鍝嶆ц兘銆傛瘮杈冨ぇ鐨勬姄鍙栧ぇ灝忓氨鍐呭瓨浣跨敤鑰岃█姣斿皬鐨勬姄鍙栧ぇ灝忚鏇存槀璐點?榛樿鐨勬姄鍙栧ぇ灝忔槸涓琛屻?/span>
If the value of setFetchMode(byte)
is FETCH_ALL, then the value of setFetchSize is disregarded.
濡傛灉setFetchMode鐨勫兼槸FETCH_ALL,鍒?tt>setFetchSize灝嗚蹇界暐銆?/tt>
For each View Object, this method is customizable. Deciding what value to use could be made at runtime based on how many rows are expected for a particular View Object.
瀵逛簬姣忎釜瑙嗗浘瀵硅薄錛岃繖縐嶆柟娉曟槸鍙畾鍒剁殑銆傚彲浠ュ湪榪愯鏃跺熀浜庝竴涓壒瀹氳鍥懼璞¢鏈熺殑琛屾暟鍐沖畾浣跨敤浠涔堝艱繘琛岃瀹氥?/span>
getRangeSize
()
Returns the range size of the iterator.
鑾峰緱榪唬鍣ㄧ殑鑼冨洿澶у皬銆?/p>
嫻嬭瘯浠g爜錛?/strong>
PerAllPeopleVOImpl employerInstance=(PerAllPeopleVOImpl) this.getPerAllPeopleVO1();
int fetchedRowCount=employerInstance.getFetchedRowCount();
int rowCount=employerInstance.getRowCount();
int rowCountInRange=employerInstance.getRowCountInRange();
long estimatedRowCount= employerInstance.getEstimatedRowCount();
int rangeSize=employerInstance.getRangeSize();
int fetchSize=employerInstance.getFetchSize();
int allRowLength=employerInstance.getAllRowsInRange().length;
int employerCount=0;
while(employerInstance.hasNext())
{
PerAllPeopleVORowImpl eachEmployer= (PerAllPeopleVORowImpl)employerInstance.next();
String empName= eachEmployer.getLastName();
employerCount++;
}
logInfo("fetchedRowCount is "+fetchedRowCount);
logInfo("rowCount is "+rowCount);
logInfo("rowCountInRange is "+rowCountInRange);
logInfo("estimatedRowCount is "+estimatedRowCount);
logInfo("rangeSize is "+rangeSize);
logInfo("fetchSize is "+fetchSize);
logInfo("employerCount is "+employerCount);
logInfo("allRowLength is "+allRowLength);
嫻嬭瘯緇撴灉錛?/strong>
fetchedRowCount is 0
rowCount is 1001
rowCountInRange is 1
estimatedRowCount is 1001
rangeSize is 1
fetchSize is 1
employerCount is 0
allRowLength is 1
闂錛?/strong>
瀹為檯鏁版嵁搴撶殑璁板綍鏁版槸錛? 9924錛宒istinct鎺夐噸澶嶇殑person_id鍚庯紝璁板綍鏁版槸3 1113銆?/p>
鍦ㄩ〉闈笂浼氭姤鍑哄涓嬭鍛婏細璀﹀憡 - 鏌ヨ宸茶秴鍑?1000 琛屻傚彲鑳藉瓨鍦ㄦ洿澶氱殑琛岋紝璇烽檺鍒舵煡璇€?/span>
涓嶇煡閬撴槸鍚︿笌姝よ緗湁鍏熾?/p>
鍏充簬next()鏂規硶錛?/p>
next
()
錛?span style="font-family: Calibri; ">ROW
Gets the next row in the iterator.
鍦ㄨ凱浠e櫒涓幏寰椾笅涓琛?/p>
This method delegates to the default RowSetIterator. If this method is called on a row set that has not yet been executed, executeQuery()
is implicitly called.
榪欎釜鏂規硶濮旀墭緇欓粯璁ょ殑RowSetIterator銆傚鏋滆繖涓柟娉曞湪琛岄泦榪樻病鏈夎鎵ц鐨勬椂鍊欒璋冪敤錛屽皢闅愬紡璋冪敤executeQuery
銆?/code>
If the current row designation is to change, ViewRowImpl.validate()
is called to validate the current row.
濡傛灉褰撳墠琛岀殑鎸囧畾琚敼鍙橈紝ViewRowImpl.validate()
琚皟鐢ㄩ獙璇佸綋鍓嶈銆?/code>
The row set has a "slot" before the first row, and one after the last row. When the row set is executed the iterator is positioned at the slot before the first row. If next()
is invoked on a newly-executed row, the first row will be returned. If next()
is called when the iterator is positioned on the last row of the row set, null
is returned and the iterator is positioned at the slot following the last row.
琛岄泦鍦ㄧ涓琛屼箣鍓嶏紝鍜屾渶鍚庝竴琛屼箣鍚庨兘鏈変竴涓?#8220;絀轟綅”銆傚綋琛岄泦琚墽琛屾椂錛岃凱浠e櫒瀹氫綅鍦ㄧ涓琛屼箣鍓嶇殑絀轟綅銆傚鏋渘ext()鍦ㄤ竴涓柊鎵ц鐨勮涓婅璋冪敤錛岀涓琛屽皢榪斿洖銆?/span>
If the iterator is at the last row of the range when next()
is called, RowSetListener.rangeScrolled()
is called to send ScrollEvent
to registered RowSetListener
s.
褰搉ext()琚皟鐢ㄦ椂錛屽鏋滆凱浠e櫒鍦ㄨ寖鍥寸殑鏈鍚庝竴琛岋紝RowSetListener.rangeScrolled()
琚皟鐢ㄥ彂閫?/code>
ScrollEvent
鍒版敞鍐岀殑RowSetListener
s銆?/p>
When successful, this method fires a NavigationEvent
to registered RowSetListener
s, by callingRowSetListener.navigated()
. The row returned is designated as the current row.
褰撴垚鍔熺殑鏃跺欙紝璇ユ柟娉曢氳繃璋冪敤RowSetListener.navigated()
瑙﹀彂NavigationEvent
銆傝繑鍥炵殑琛岃鏍囧織涓哄綋鍓嶈銆?/p>