Hello,
I want to use a CriteriaQuery execute the following queries in one go, but not sure how to implement it in Hibernate (CriteriaQuery),
Quote:
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);
I would use the following implementation to achieve this,
1. create 4 NamedQuery as I mentioned above, and then use CriteriaQuery to execute each of them in sequential order, within the Query.setLockMode block.
2. create a single custom query with CriteriaQuery, but I don't know how to do it.
Your thought and suggestion is very appreciated.
Thanks
Sam