Hi Tapestry Users, Geoff - what a brilliant demo of tapestry's tree/zone/ajax goodness you have at http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/treefromdatabasewithzones
I ran into a couple of things that slowed my day yesterday, all in the service layer - just relaying them here. I'm using subnets instead of dewey classification system. ======= in jumpstart node children query (classificationNodeInfo) NOTE: I'm using glassfish v3.1.2 which has eclipselink. that native query for finding children was particularly nasty for fetching results with parameter substitution. I did this hackily for it to work, otherwise would only ever get 1 result - you'll note that i just put the parameter in the buf.append at the correct spot. yes, very ugly - reminds me of the 90s stringbuffer protocol stuff i used to do :) Set<Long> setOfIds = subnetNodeHelpersById.keySet(); String tmp = ""; for (Long ll : setOfIds) { tmp += ll.toString() + ","; } String queryParameterCorrected = tmp.substring(0, (tmp.length() - 1)); // This JPQL query should have worked but Hibernate translates the count to "count(.)" which is invalid SQL // (a Hibernate bug?)... // buf.append("select c1.id, count(c1.children) from Classification c1"); // buf.append(" where c1.id in (:catIds) "); // buf.append(" group by c1.id"); // Query q = em.createQuery(buf.toString()); // ...so we use a native query instead buf.append("select c1.id, count(c2.id) from subnet c1"); buf.append(" left join subnet c2 on c2.parentId = c1.id"); buf.append(" where c1.id in ("); buf.append(queryParameterCorrected); buf.append(") "); buf.append(" group by c1.id"); Query q = em.createNativeQuery(buf.toString()); ======== return lists of findChildren() and findSubnetsWithNoParent() needed to be cast, i was getting exceptions in my env @SuppressWarnings("unchecked") private List<Subnet> findChildren(Long id) { return (List<Subnet>) em.createNamedQuery(Subnet.QUERY_FINDBYPARENTID).setParameter("id", id).getResultList(); } @SuppressWarnings("unchecked") private List<Subnet> findSubnetsWithNoParent() { return (List<Subnet>) em.createNamedQuery(Subnet.QUERY_PARENTISNULL).getResultList(); } ========== Cheers Chris