Hi devs. I almost completed implementation of QueryManager (see http://markmail.org/message/l3zlqq4kqndokkif )
I think we should use named queries in core whenever possible, because it reduce code size and independent from query languages. It is also best practice in db world. I would like to discuss about: How we should store/load named queries? 1. Hibernate Named queries in hibernate usually stored in mapping files. (see http://www.hibernate.org/hib_docs/v3/reference/en/html/objectstate.html#objectstate-querying-executing-named ) I think we should use this way too. So I propose to add queries.hbm.xml - special hibernate mapping for queries. Here is example: {code} <hibernate-mapping> <query name="getSpaceDocsName"> select distinct doc.name from XWikiDocument doc where doc.space=:space </query> ... {/code} 2. JCR Analogue for named queries in JCR is queries stored in special jcr nodes. So queries stored *inside* repository. Queries are content. But there is a problem how to initialize them at startup: 2.1) We can use standard import feature of JCR and import queries from xml file at startup. -: import needed for all workspaces (all virtual xwiki) -: increase time of startup -: slightly verbose xml file (<testquery jcr:primaryType="nt:query" jcr:language="xpath" jcr:statement="//*"/>) +: potentially faster quering. 2.2) Or we can don't use queries as nodes feature of JCR and store/load queries by self for example in standard java.util.ResorceBundle (for example jcr/Queries.properties). +: simple, universal, independent. There is another way: use ResourceBundles for both Hibernate and JCR. But I think we should use Hibernate's way for named queries. There is no standard way for init named queries in JCR except import. But import has much disadvantages. So I'd like to use ResourceBundle for jcr named queries. So, in short, I propose: add Queries.hbm.xml for hibernate named queries. add jcr/Queries.properties for jcr named queries. (xpath) WDYT? -- Artem Melentyev _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

