xception in thread "main" javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute statement code example

Example 1: javax.persistence.persistenceexception: org.hibernate.exception.sqlgrammarexception: could not execute statement

Query query = this.entityManager.createNativeQuery(searchQuery, "TicketMapping");
//--------------------------------------------------------------------^^
//This should be the ObjectName.class

Example 2: javax.persistence.persistenceexception: org.hibernate.exception.sqlgrammarexception: could not execute statement

Query query = this.entityManager.createNativeQuery("YourQuery", ObjectName.class);

Tags:

Java Example