* @param ownerSM StateManager of the owning object
* @return The iterator for the entries (<pre>map.entrySet().iterator()</pre>).
*/
public Iterator iterator(ObjectProvider ownerSM)
{
ExecutionContext ec = ownerSM.getExecutionContext();
if (iteratorStmtLocked == null)
{
synchronized (this) // Make sure this completes in case another thread needs the same info
{
// Generate the statement, and statement mapping/parameter information
SQLStatement sqlStmt = getSQLStatementForIterator(ownerSM);
iteratorStmtUnlocked = sqlStmt.getSelectStatement().toSQL();
sqlStmt.addExtension("lock-for-update", true);
iteratorStmtLocked = sqlStmt.getSelectStatement().toSQL();
}
}
Transaction tx = ec.getTransaction();
String stmt = (tx.lockReadObjects() ? iteratorStmtLocked : iteratorStmtUnlocked);
try
{
ManagedConnection mconn = getStoreMgr().getConnection(ec);
SQLController sqlControl = getStoreMgr().getSQLController();