It's entirely up to you, I don't think either of these ways if more or
less future-proof than the other. Our *Util classes are in general
there to help with repetitive tasks. I'd use the 2nd approach when i
want explicit control on what context and what hierarchy manager is
used, for example; the *Util equivalent will generally use a "best-
guess" approach.
-g
On Oct 22, 2008, at 5:26 PM, Matteo Pelucco wrote:
...these approaches to queries?
QueryUtil is only a "wrapper"? It is preferable for future
developments?
- 1 -
String itemType = "myType";
String queryString = "SELECT * FROM " + itemType;
String repository = "data";
String queryType = "sql";
Collection items = QueryUtil.query(repository, queryString,
queryType, itemType);
- 2 -
String itemType = "myType";
String queryString = "SELECT * FROM " + itemType;
String repository = "data";
String queryType = "sql";
QueryManager qm =
MgnlContext.getHierarchyManager(repository ).getQueryManager();
Query q = qm.createQuery(queryString , queryType);
QueryResult qr = q.execute();
Collection items = qr.getContent(itemType);
Thanks..
..again!
Matteo
----------------------------------------------------------------
for list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
----------------------------------------------------------------