ObjectDB ObjectDB

java.lang.UnsupportedOperationException

#1

com.objectdb.o.InternalException: java.lang.UnsupportedOperationException: Unsupported feature - Update queries are not supported yet
java.lang.UnsupportedOperationException: Unsupported feature - Update queries are not supported yet.

Used with this code:

"DELETE l FROM License l WHERE l.id = ?1", License.class);
   query.setParameter(1, id);
   int changes = query.executeUpdate();

Is there a workaround?

edit
delete
#2

The obvious workaround is to use remove:

List results = query.getResultList();
em.getTransaction().begin();
for (Object entity : results)
    em.remove(entity);
em.getTransaction().commit();

Another option is to run a JDO DELETE query, e.g.

em.getTransaction().begin();
em.unwrap(PersistenceManager.class).newQuery(License.class).deletePersistentAll();
em.getTransaction().commit();

JPA DELETE queries are expected to be supported soon. You may subscribe to this issue.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.