Derek,

Those links are *extremely* good - thank you! I've not really done
anything with tree structures before and they are really, really
usefull.

One thing however, it appears the optimal way of  doing the insert
queries would be with stored procedures, however that im not down
with, and ideally, i want to keep database vendor independent (part of
the point of using JPA) so ideally i want to suck that up into the
application logic. For instance:

--START
SELECT @myRight := rgt FROM nested_category WHERE name =
'TELEVISIONS';

UPDATE nested_category SET rgt = rgt + 2 WHERE rgt > @myRight;
UPDATE nested_category SET lft = lft + 2 WHERE lft > @myRight;

INSERT INTO nested_category(name, lft, rgt) VALUES('GAME CONSOLES',
@myRight + 1, @myRight + 2);
--END

This makes use of variables, and i could of course do this via 3
separate queries in JPA, but i wondered if there was a neater way to
construct this type of thing with JPA?

Any advice you guys have is most welcome

Cheers

Tim


On Nov 30, 2:27 pm, "Derek Chen-Becker" <[EMAIL PROTECTED]> wrote:
> If you're heavily skewed towards reads and not writes (as it seems in the
> case of a CMS), you might want to look at Celko nested sets:
>
> http://www.intelligententerprise.com/001020/celko.jhtml
> http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
>
> A little more work on updates than an adjacency model, but a lot more
> efficient.
>
> Derek

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to