Search code examples
javacassandrajpqlcqlkundera

Kundera for Cassandra - Deleting record by row key


I'm trying to delete specific record from database by row key. But when I try to execute this query:

 Query query = em.createQuery(
            "DELETE FROM User u WHERE u.userId = :u");

 query.setParameter("u", userID).executeUpdate();

I got this exception: "Condition = is not suported for query on row key!".

Is there any workaround, or I missing something?


Solution

  • What you can do as a workaround is:

    Find using: User u = em.find(User.class, userId)

    and then, em.delete(u);