; > > 4. If you code to an interface, you can do all sorts fancy things
>>> with
>>> > > proxies including the interceptor pattern
>>> > >
>>> > > Some further reading
>>> > > http://en.wikipedia.org/wiki/Inversion_of_contr
de();
>> > >childNode.setCategory(cat);
>> > >childNodes.put(cat.getId(), childNode);
>> > >}
>> > >if (!childNodes.isEmpty()) { // if empty, the next query
d = c1.id "
> > >+ "where c1.id in (:catIds) "
> > >+ "group by c1.id");
> > >
> > > query.setParameterList("catIds",
> > childNodes.keySet().toArray());
> > > List
ult = query.list();
> >
> > for (Iterator it = query.iterate(); it.hasNext(); ) {
> > Object[] result = it.next();
> > Long childId = (Long) result[0];
> > Integer grandChildCount = (Integer) result[1];
>
45711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5495879.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: us
; Long childId = (Long) result[0];
> > Integer grandChildCount = (Integer) result[1];
> > CategoryNode childNode = childNodes.get(childId);
> > childNode.setHasChildren(grandChildCount != 0);
ArrayList(childNodes.values());
>
> Cheers,
> Lance
>
> On 18 February 2012 02:55, George Christman <[hidden
> email]<http://user/SendEmail.jtp?type=node&node=5495019&i=0>>
> wrote:
>
> > btw, I should mention the model exception only happens while trying to
> &g
George Christman wrote:
> btw, I should mention the model exception only happens while trying to
> expand
> the tree node. It produces an ajax exception.
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Tapestry-Tr
btw, I should mention the model exception only happens while trying to expand
the tree node. It produces an ajax exception.
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5494602.html
Sent from the Tapestry - User mailing list archive at
end development like myself. I will email you with the code once I
have it fully working.
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5494596.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>> and instructor
>> Owner, Ars Machina Tecnologia da Informação Ltda.
>> http://www.arsmachina.com.br
>>
>> -
Hi, I 've seen Lance's ways of implementing hierarchical data on a flat
table... and I think it could be improved adding two index columns as it
says here:
http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/
there you could easily query for example to a complete branch of the tree
On Fri, 17 Feb 2012 12:07:52 -0200, George Christman
wrote:
So what is the final query recommendation? Are we sticking with HQL, or
are we converting it to use the Criteria API?
In this case, the structure of the query is static, just the number of
parameters in the "in" clause is dynami
y 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
> -
> To unsubscribe, e-mail: [hidden
> email]<http://user/SendEmail
On Fri, 17 Feb 2012 10:14:31 -0200, Lance Java
wrote:
I'm talking about this:
"where c1.id in (" + questions + ") "
I'm hoping you realise that questions is just a comma separated string of
question marks eg "?, ?, ?" so it's SQL injection safe.
I haven't thought of that, but there's a be
Ah, just saw in the javadoc you can provide a type parameter to
setParameterList(). This is getting OT
Cheers,
Lance
On Friday, 17 February 2012, Lance Java wrote:
>> I'm talking about this:
>>
>> "where c1.id in (" + questions + ") "
> I'm hoping you realise that questions is just a comma separ
> I'm talking about this:
>
> "where c1.id in (" + questions + ") "
I'm hoping you realise that questions is just a comma separated string of
question marks eg "?, ?, ?" so it's SQL injection safe.
>
> He should use Query.setParameterList() instead.
Cool, I didn't know about this. I'm assuming hib
On Fri, 17 Feb 2012 09:18:36 -0200, Lance Java
wrote:
Thiago,
Hi, Lance!
please re-read the code... It is using parameters (indexed rather
than named) and cannot be SQL injected.
I'm talking about this:
"where c1.id in (" + questions + ") "
He should use Query.setParameterList() inste
Thiago, please re-read the code... It is using parameters (indexed rather
than named) and cannot be SQL injected.
On Friday, 17 February 2012, Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:
> On Fri, 17 Feb 2012 03:37:30 -0200, George Christman <
gchrist...@cardaddy.com> wrote:
>
>> I
On Fri, 17 Feb 2012 03:37:30 -0200, George Christman
wrote:
I did make further progress with the query, I fixed the count exception
with count(c2.id).
"select c1.id, count(c2.id) "
+ "from CATEGORY c1 "
+ "left join CATEGORY c2 on c2.parentCate
gt;>
>> >>// this will be called by ValueEncoder.toValue(id)
>> >>public CategoryNode findById(String id) {
>> >>return findByCriterion(Restrictions.eq("categoryId",
>> >> id)).iterator().next();
>> >>}
>> >>
>> >&
> >>}
> >>
> >>
> >>Query query = session.createSQLQuery(
> >>"select c1.id, count(c2.*) "
> >>+ "from Category c1 "
> >>+ "left join Category
up as a service, but it
was giving me issues injecting it. I'll revisit it tonight.
Cheers,
George
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5489540.html
Sent from the Tapestry - User mailing list a
Just taking another look I can see a couple of issues.
1. Are categoryId and parentCategoryId long's? If so, findById() should
take a long (not a string). If they are strings, the query should use
setString() instead of setLong(). Something has to change ;)
2. getChildren() should use Restriction
return new DefaultTreeSelectionModel();
>}
>
>public TreeModel getTreeModel() {
>if (treeModel == null) {
>ValueEncoder encoder = new
> ValueEncoder() {
>
>@Override
>public String toClient(CategoryNode node) {
>return node.getCategory().getId().toString();
>}
>
>@Override
>public CategoryNode toValue(String node) {
>return hibernateCategoryDao.findById(node);
>}
>};
>
>treeModel = new DefaultTreeModel(encoder, new
> CategoryTreeModelAdapter(hibernateCategoryDao),
> hibernateCategoryDao.findRoots());
>}
>return treeModel;
>}
> }
>
>
> Tree.tml
> t:tree t:model="model" t:selectionModel="selectModel"/>
>
>
> --
> View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5488350.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
CategoryNode toValue(String node) {
return hibernateCategoryDao.findById(node);
}
};
treeModel = new DefaultTreeModel(encoder, new
CategoryTreeModelAdapter(hibernateCategoryDao),
hibernateCategoryDao.findRoots());
}
return treeMod
eturn;
>}
>};
> //Haven't figured out how to obtain rootNodes.
> selectModel = new DefaultTreeModel(encoder, new
> CategoryTreeModelAdapter(session), rootNodes);
>}
>
>return selectModel;
>}
>
> Cheers,
> Geor
lectModel = new DefaultTreeModel(encoder, new
CategoryTreeModelAdapter(session), rootNodes);
}
return selectModel;
}
Cheers,
George
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5484903.html
Sent from the Tapestry - User mailing
l;
}
}
Thanks Lance.
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5482910.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
-
To unsubscribe, e-mail:
t; understanding this correctly?
>
> You stated in an earlier response that your code could be modified to
> support Tapestry's ajax request. Do you happen to have any working
examples
> of how to get the TreeModel to dynamically request the query?
>
> Thanks Lanc
modified to
support Tapestry's ajax request. Do you happen to have any working examples
of how to get the TreeModel to dynamically request the query?
Thanks Lance
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5471508.html
Sent from the Tap
f() and hasChildren() for each child.
On Wednesday, 8 February 2012, tgupta1419 wrote:
> For getting a tree and if there are thousands of nodes - wouldn't it be a
> problem getting all the nodes in the memory and then processing it.
>
> --
> View this message in context:
h
For getting a tree and if there are thousands of nodes - wouldn't it be a
problem getting all the nodes in the memory and then processing it.
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5467951.html
Sent from the Tapestry - User mailing
Thanks Lance
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5467939.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
-
To unsubscribe, e-mail: users
>
> --
> View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5464526.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe
How will the relation query look like to get this tree from the database.
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5464526.html
Sent from the Tapestry - User mailing list archive at Nabble.com
Thanks Lance, sorry about the mixup. I think your in sight is enough to get
me going again.
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5463364.html
Sent from the Tapestry - User mailing list archive at Nabble.com
a single table with a parent node in each row. If
parent
> is null, it becomes the root, other wise it would become the child of the
> linked parent. Would you consider this a good / bad design? and would it
> work for this model?
>
> Thanks,
> George
>
> --
> View this
ent
is null, it becomes the root, other wise it would become the child of the
linked parent. Would you consider this a good / bad design? and would it
work for this model?
Thanks,
George
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5463173.htm
i").addChildrenNamed("F430", "California"));
>>
>>
>> TreeExample numbers = new TreeExample("Numbers");
>>for (int i = 0; i < 1; i++) {
>>numbers.addChild(new
TreeExample(Integer.toString(i))
ple("Ferarri").addChildrenNamed("F430", "California"));
>
>
>TreeExample numbers = new TreeExample("Numbers");
>for (int i = 0; i < 1; i++) {
>numbers.addChild(new
TreeExample(Int
; i < 1; i++) {
numbers.addChild(new TreeExample(Integer.toString(i)));
}
ROOT.addChild(numbers);
}
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-TreeGrid-tp5462126p5462126.html
Sent from the Tapestry - User mailing list archive at Nabble.
42 matches
Mail list logo