Does FireStorm/DAO support complex queries, bulk updates, and stored procedures?
Overview
Custom DAOs are used when you have a complex SQL query that goes beyond the simple CRUD (create, update, delete) operations on a single table. Examples would be SQL queries that perform a join between several tables, queries that performs aggregration using the GROUP BY operator, bulk update or delete queries, and stored procedures.
Example queries that the Custom DAO feature can support:
SELECT a.*, b.* FROM a, b WHERE a.id = b.id AND b.install_date between ? and ?
DELETE customer WHERE status = ? AND create_date = ?
BEGIN ADD_JOB_HISTORY(:empId, :startDate, :endDate, :jobId, :deptId); END;
SELECT product, count(*) FROM product WHERE download_date > ? GROUP BY product
Code Sample
CompanyDownloadSummaryDao dao = CompanyDownloadSummaryDaoFactory.create();
CompanyDownloadSummary result[] = dao.execute();
for (int i = 0; i < result.length; i++)
{
if (result[i].getTotal() > 2)
{
System.out.println(
result[i].getCompany() + " downloaded " +
result[i].getProduct() + " " +
result[i].getTotal() + " times."
);
}
}


