What Does executeEmptyRowSet() Do?

A user asks "I've seen a few forum posts that say to use executeEmptyRowSet to programmatically clear the VO? What does the method actually do - I didn't see anything in the javadoc."

I filed a bug 9156214 to get the JavaDoc improved in a future release, but in the interim I'll explain it here.

The RowSet.executeEmptyRowSet() method performs the logical equivalent of executing your view object with a predicate like "WHERE 1 = 2" (always false!) in a more efficient way.The result is that the rowset has no rows in it (just like if you had executed a query that returned no rows), however it achieves this without actually sending a query to the database.

After calling executeEmptyRowSet(), the rowset it empty and the VO has its "isExecuted" flag marked to true. This would mean that subsequent attempts to reference data in the VO from the data binding layer will not try to implicitly execute the query because they notice the VO is already executed.

The rowset persists information about its state to the state management passivation snapshot -- see section 40.5 What Model State Is Saved and When It Is Cleaned Up in the dev guide for more information on this -- so that during the state activation a view object that had previously been executed as empty via executeEmptyRowSet() will be again activated as empty to return to the same state it was in at the moment of state passivation.

Comments:

Post a Comment:
Comments are closed for this entry.
About
Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today