Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8781231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:14:47+00:00 2026-06-13T20:14:47+00:00

My DELETE query is failing. Here’s my code: String q = SELECT p.id FROM

  • 0

My DELETE query is failing.

Here’s my code:

String q = "SELECT p.id FROM Person p, DomainGroup g WHERE 
   p member of g.coordinators" + " AND g.id = :groupId 
   AND p.id = :personId";

List<Long> test = getEntityManager()
  .createQuery(q).setParameter("groupId", followingId)
  .setParameter("personId", followerId).getResultList();

log.debug("test = " + test);

String deleteGroupCoordinatorQuery = 
  "DELETE FROM Person p, DomainGroup g WHERE p member 
     of g.coordinators" + " AND g.id = :groupId 
        AND p.id = :personId";

List<Long> test = getEntityManager()
      .createQuery(deleteGroupCoordinatorQuery).setParameter
      ("groupId", followingId)
      .setParameter("personId", followerId).executeUpdate();

output:

test = [1,2,3]

2012-10-26 13:44:56,437 ERROR org.company.commons.server.service.ServiceActionController - Error occurred performing transaction. java.lang.IllegalArgumentException: node to traverse cannot be null!
        at org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:55)
        at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:280)
        at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182)
        at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:14:48+00:00Added an answer on June 13, 2026 at 8:14 pm

    You define multiple “query roots” (Person p and DomainGroup g), but a DELETE query can have only one such root.

    You want something like:

    delete Person p
    where p.id in (
        select c.id
        from DomainGroup g
            join g.coordinators c
        where g.id = :groupId
          and c.id = :personId
    )
    

    or

    delete Person p
    where p.id = :personId
      and p.id in (
        select c.id
        from DomainGroup g
            join g.coordinators c
        where g.id = :groupId
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the code: mysql_query(DELETE . $_GET['id'] . FROM forum_favorites WHERE thread_id=' . $_GET['id'] .
Is there better way to delete a parameter from a query string in a
I want to delete rows from multiple tables. I know the select query, but
I wanted to write a query to delete from x table and y table
I have a query like DELETE from tablename where colname = value; which takes
I'm trying to delete with qt with this code: int jobId = 655; query.prepare(DELETE
Given a query like the following: DELETE FROM FOO WHERE ID in (1,2,3,4,....); Is
When I type this query in MySQL : DELETE FROM myTable WHERE ID =
I would like to delete all the rows found by that query: SELECT cart_abandon.*
I have a DELETE query which deletes a record from a mysql db. is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.