Skip to content

Instantly share code, notes, and snippets.

@brmeyer
Created June 11, 2013 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brmeyer/8434aee0de36e0639d0f to your computer and use it in GitHub Desktop.
Save brmeyer/8434aee0de36e0639d0f to your computer and use it in GitHub Desktop.
EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin();
em.createQuery(
"delete Attrvalue aval where aval.id in ( "
+ "select val2.id from Employee e, Employeegroup eg, Attrset aset, Attrvalue val2 "
+ "where eg.id = e.employeegroup.id " + "and aset.id = e.attrset.id "
+ "and val2.id member of aset.attrvalues)").executeUpdate();
em.getTransaction().commit();
4.1.7
delete
from
Attrvalue
where
id in (
select
attrvalue4_.id
from
Employee employee1_ cross
join
Employeegroup employeegr2_ cross
join
Attrset attrset3_ cross
join
Attrvalue attrvalue4_
where
employeegr2_.id=employee1_.employeegroup_id
and attrset3_.id=employee1_.attrset_id
and (
attrvalue4_.id in (
select
attrvalue6_.id
from
ATTRSET_X_ATTRVALUE attrvalues5_,
Attrvalue attrvalue6_
where
attrset3_.id=attrvalues5_.Attrset_id
and attrvalues5_.attrvalues_id=attrvalue6_.id
)
)
)
4.1.8
delete
from
Attrvalue
where
id in (
select
attrvalue4_.id
from
Employee employee1_ cross
join
Employeegroup employeegr2_ cross
join
Attrset attrset3_ cross
join
Attrvalue attrvalue4_
where
employeegr2_.id=employee1_.employeegroup_id
and attrset3_.id=employee1_.attrset_id
and (
attrvalue4_.id in (
select
attrvalues5_.attrvalues_id
from
ATTRSET_X_ATTRVALUE attrvalues5_
where
Attrset.id=attrvalues5_.Attrset_id
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment