I'm trying to delete the objects in the database.
My first attempt was:
public void removeAll(){
TypedQuery<anObject> query = em.createQuery(
"DELETE FROM tablName",
anObject.class);
query.executeUpdate();
}
this gave me an exception so I had a look at the example on the objected site and updated my code to resemble theirs:
public int removeAll(){
int deleted = em.createQuery(
"DELETE FROM tableName").executeUpdate();
}
I'm getting the same exception:
com.objectdb.o._TransactionRequiredException: Attempt to run update query when no transaction is active
anyone know what I can do to solve?