Hi
I am trying to update a row in MariaDB database table using hibernate. It is like this :
public static void updateJPQL() {
EntityManager entmngr = JPAProvider.getEntityManager();
EntityTransaction transaction = entmngr.getTransaction();
transaction.begin();
Query query = entmngr.createQuery("UPDATE users o set o.name = 'John' where o.id =: NID");
query.setParameter("NID", 2L);
query.executeUpdate();
transaction.commit();
entmngr.close();
}
Hibernate gives this error :
Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.sql.ast.SqlTreeCreationException: Could not locate TableGroup - NavigablePath[model.entity.Users(o)]
the other queries would execute fine. I could insert into my table, I could fetch all of the records but this update query is the problem.