java.lang.ClassNotFoundException: javax.persistence.NamedStoredProcedureQuery - Hibernate Error

Evan picture Evan · Jan 31, 2015 · Viewed 8.3k times · Source

Above exception has been throwing While creating a hibernate session factory.

enter image description here

In application lib folder have hibernate-jpa-2.1-api and javax.persistence.2.1.0. I can able to see the NamedStoredProcedureQuery class in both jar. But I am getting runtime error for classnotfoundexception. Any suggestion?

Answer

Evan picture Evan · Feb 1, 2015

NamedStoredProcedureQuery class is available in hibernate-jpa-2.1-api jar. But this jar refers some other jar in run time. So I didn't get error in compile time and getting exception during runtime. I just added other hibernated libs through maven repository.Initially i used only hibernate-core. Now artifactIDs are hibernate-core,hibernate-validator,hibernate-commons-annotations,hibernate-jpa-2.0-api and hibernate-entitymanager.