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 calling next() until the last row is retrieved. Thus, since
it iterates through the View Object one record at a time, this method may be
slow.
该方法通过执行视图对象的查询从视图对象中获取所有行,然后调用next()直到最后一行被调用。于是,由于它通过视图对象一次迭代一条记录,因此该方法是比较慢的。
If you
are working with a large number of rows, or if your application demands a fast
response, use getEstimatedRowCount
to obtain a quicker count.
如果你操作一大堆行,或者你的应用需要一个快速的响应,使用getEstimatedRowCount
获得一个更快的数量。
The
following sample code uses getRowCount() to set up separate iterators for even
numbered and odd numbered rows:
下面的代码使用getRowCount()为基数和偶数行创立独立的迭代器。
// 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
()
:int
Gets the size of the current
RowSet's
range
获得当前RowSet(记录集)的范围大小。
getFetchedRowCount
()
:int
Counts the number of rows
fetched from the JDBC result set.
计算从JDBC结果集抓取的行数。
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. 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.
该方法被用于确定视图对象是否从游标中读取所有的行。例如,getEstimatedRowCount
返回视图对象上count(*)相等的量。getFetchedRowCount()方法只返回已经抓取的行数。如果getFetchedRowCount()返回的值小于getEstimatedRowCount(),那么视图对象没有从游标中读到所有行。
getEstimatedRowCount
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 of getRowCount.
Note however, that this method might not be as accurate as
getRowCount().
注意:但是,这个方法可能没有getRowCount准确。
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行预抓取大小。注意行预抓取大小影响性能。比较大的抓取大小就内存使用而言比小的抓取大小要更昂贵。
默认的抓取大小是一行。
If the
value of setFetchMode(byte)
is FETCH_ALL, then the value of setFetchSize is disregarded.
如果setFetchMode的值是FETCH_ALL,则setFetchSize将被忽略。
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.
对于每个视图对象,这种方法是可定制的。可以在运行时基于一个特定视图对象预期的行数决定使用什么值进行设定。
getRangeSize
()
Returns the range size of the
iterator.
获得迭代器的范围大小。
测试代码:
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);
测试结果:
fetchedRowCount is 0
rowCount is 1001
rowCountInRange is 1
estimatedRowCount is 1001
rangeSize is 1
fetchSize is 1
employerCount is 0
allRowLength is 1
问题:
实际数据库的记录数是:5 9924,distinct掉重复的person_id后,记录数是3
1113。
在页面上会报出如下警告:警告 - 查询已超出 1000
行。可能存在更多的行,请限制查询。
不知道是否与此设置有关。
关于next()方法:
next
()
:ROW
Gets the next
row in the iterator.
在迭代器中获得下一行
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
。
If the current row designation is to
change, ViewRowImpl.validate()
is called to validate the
current row.
如果当前行的指定被改变,ViewRowImpl.validate()
被调用验证当前行。
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.
行集在第一行之前,和最后一行之后都有一个“空位”。当行集被执行时,迭代器定位在第一行之前的空位。如果next()在一个新执行的行上被调用,第一行将返回。
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.
当next()被调用时,如果迭代器在范围的最后一行,RowSetListener.rangeScrolled()
被调用发送
ScrollEvent
到注册的RowSetListener
s。
When successful, this method fires a
NavigationEvent
to registered RowSetListener
s, by calling RowSetListener.navigated()
. The row returned is
designated as the current row.
当成功的时候,该方法通过调用RowSetListener.navigated()
触发NavigationEvent
。返回的行被标志为当前行。
分享到:
相关推荐
关于VO、PO的理解——java的(PO,VO,TO,BO,DAO,POJO)解释
海思3531A_虚拟VO调试
由表名生成vo
jsp VO 循环显示,取vo数据,分隔,展示到table里面
po与vo区别.docpo与vo区别.docpo与vo区别.doc
根据数据库中表的字段自动生成java中的vo类,方便调用
nc57保存VO的几种方法sdafsgsfgddsddfsfddfdewdddfdfdfdfa
简单的vopo转换功能及依赖jar
Vo Lam 3 abc
介绍vo,bo,po的区别。看其他网站收集的资料。
3515取vo数据并编码,好像原厂的sdk中并没这样的sample。刚发现传网上吧。
如果想生成未预置的代码,如vo对象、前端vue页面以及其他自定义代码等,需要做一些定制和扩展来实现。 从使用角度而言,官方资料介绍得比较简要,要实际使用,仍然需要进行具体的尝试和摸索,包括必要时看下源码...
VO生成工具,带操作说明,很方便,会根据输入的属性自动生成set/get方法(还带注释)
根据NC6系列全路径VO类名查询对应的物理表名
一款自动生成POVO 的工具,双击即可 运行,默认配置文件:lib/defaultconfig.properties
Laravel开发-laravel-vo 充分利用Laravel中的价值对象
分页试题类编写
NULL 博文链接:https://lixue150.iteye.com/blog/1861174
E-Sys - F系列车型设FA(VO)码操作步骤
六步骤轻松完成Hibernate中生成VO.xml(doc)