Queries

Resoa Persistence supports SQL like queries to the database, main class for complex data retrieval is org.resoa.grid.RecordSet.

Some examples:

public void recordsetExample (User user, ResoaResponse response, ResoaGateway gateway) {
	// RecordSet examples
	try {
	// Read by regex expression, transmitted within an user name property
	RecordSet processingRules = new RecordSet();
	processingRules.setSQLWhere(surname = 'Smith');
	List<User> userList = gateway.getPersistence().read (User.class, processingRules);	
	precessingRules = RecordSet.getSQLWhereInstance("id like'101%'");
	userList = persistor.read(User.class, processingRules);
	// Read the first 50 matching records
	processingRules.setRecordCounts(50);
	userList = gateway.getPersistor().read(User.class, processingRules))
	// Continue reading the next records, by comparing the last read key. Works only for BTREE based persistence !
	processingRules = RecordSet.getNextRecordsInstance(processingRules, true);
	userList = gateway.getPersistor().read(User.class, processingRules));
} catch (PersistenceException e) {
	// handle errors here
}}

SQL Where expressions are supported within BTREE key/value databases as well, check the org.resoa.persistence.btree.SqlSelectExpression source file for more information about.