Cookbook sample

Executing Update (insert, update, delete)

$product = new Product();
$product->setId(1);
$product->setDescription('Shih Tzui');

$key = $sqlMap->insert('insertProduct', $product);

Executing Query for Object (select)

$key = 1;
$product = $sqlMap->queryForObject ('getProduct', $key);

Executing Query for Object (select) With Preallocated Result Object

$customer = new Customer();

$sqlMap->beginTransaction();

$sqlMap->queryForObject('getCust', $parameter, $customer);
$sqlMap->queryForObject('getAddr', $parameter, $customer);
$sqlMap->commitTransaction();

Executing Query for List (select)

$list = $sqlMap->queryForList ('getProductList');

Executing Query for List (select) With Result Boundaries

$list = $sqlMap->queryForList ('getProductList', $key, null, 0, 40);

Executing Query for Paginated List (select)

$list = $sqlMap->queryForPagedList ('getProductList', null, 10);
$list->nextPage();
$list->previousPage();

Executing Query for Map

$map = $sqlMap->QueryForMap('getProductList', null, 'productCode');
 $product = $map['EST-93'];