db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Göschl,Siegfried" <Siegfried.Goes...@drei.com>
Subject RE: LargeSelect problems
Date Tue, 13 Jan 2004 10:57:39 GMT
Don't know if this helps

public void testLargeResultSet()
	{
		int resultSize1 = 0;
		int resultSize2 = 0;
		
		try
		{			
			// Make a query with a given country and unlimited result set
			Criteria criteria1 		= new Criteria();
			criteria1.addAscendingOrderByColumn( CountryPeer.SORTSEQUENCE );
			List countryList 		= CountryPeer.doSelect( criteria1 );
			resultSize1				= countryList.size();

			// Make the same query as large select and paging through the reseult set
			Criteria criteria2 		= new Criteria();
			criteria2.setDbName( "WEBSHOP" );
			CountryPeer.addSelectColumns( criteria2 );
			criteria2.addAscendingOrderByColumn( CountryPeer.SORTSEQUENCE );
			LargeSelect largeSelect = new LargeSelect( criteria2, 10, 5, CountryPeer.class.getName()
);
			
			while( largeSelect.getNextResultsAvailable() )
			{
				countryList 		= largeSelect.getNextResults();				
				resultSize2			= resultSize2 + countryList.size();
				// System.out.println( ">>> " + largeSelect.getPageProgressText() + " <<<"
);
				// System.out.println( "Got the following number of countries : " + countryList.size()
);
			}
			
			assertEquals( "The result set of a simple query and large select was different", resultSize1,
resultSize2 );
		}

		catch( Exception e )
		{
			e.printStackTrace();
			fail( e.getMessage() );
		}
	}

-----Original Message-----
From: Bogdan Vatkov [mailto:bvatkov@globaltech-bg.com]
Sent: Tuesday, January 13, 2004 11:23 AM
To: TORQUE_LIST
Subject: LargeSelect problems


Hi All,

I have the following code snipplet..

  public List getList() {
    try {
      return VpbxPeer.populateObjects(businessObjectList);
    } catch (Exception e) {
      logError(e);
      return null;
    }
  }


  private void LoadLargeSelect(Criteria parameter) {
      largeSelect = new LargeSelect(parameter, PAGE_SIZE, PAGES_FETCH_COUNT);
      largeSelect.run();
      try {
        largeSelect.getNextResults();
      } catch (Exception e) {
        logError(e);
      }
  }


Problem1:
After executing LoadLargeSelect() and one of the getNext/PreviuosResults methods i have the
rows doubled in my list..i've checked the debug prints of the LargeSelect ..its rowcount is
doubled itself.
- what i am doing wrong ? what might be the reason for this row duplication.
Problem2:
Too often (i use the code above in a JSP/Servlet environment) i get the 
java.util.ConcurrentModificationException
when executing the getList() method.
What I am missing? 
Is there any tutorial for LargeSelect (a simple example of using this class)?

With best regards,
Bogdan


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message