This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

How To Solved : "org.hibernate.exception.SQLGrammarException: could not execute query"  RSS feed

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys,
I'm making Native SQL in Hibernate, but I have some problem when I'm trying to execute my SQL. Here is my SQL:


and the error is:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)
javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

root cause

org.hibernate.exception.SQLGrammarException: could not execute query



I'm trying to solved them, but it still not working.

Thanks in advance.
 
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Irliyanti Rahmadhani Lubis,

First of all, a warm welcome to CodeRanch!

Irliyanti Rahmadhani Lubis wrote:org.hibernate.exception.SQLGrammarException: could not execute query

I'm trying to solved them, but it still not working.


What happens when you execute that query directly on the database using a SQL Client program like Squirrel or the client which comes with your database?

Kind regards,
Roel
 
Irliyanti Rahmadhani Lubis
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Roel De Nijs wrote:Hi Irliyanti Rahmadhani Lubis,

First of all, a warm welcome to CodeRanch!

Irliyanti Rahmadhani Lubis wrote:org.hibernate.exception.SQLGrammarException: could not execute query

I'm trying to solved them, but it still not working.


What happens when you execute that query directly on the database using a SQL Client program like Squirrel or the client which comes with your database?

Kind regards,
Roel




Thank you for the answer, Roel.
I change my SQL to :


and the SQL is success when I try in TOAD for Oracle. But, when I try to implementation in Java, there's no effect. I don't know where the problem
 
Roel De Nijs
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm definitely not a Hibernate expert, and certainly not when it comes down to writing native queries But I think a good starting point would be the native SQL Queries chapter from Hibernate. And I would start with a very easy query (e.g. select just one field from a table). Once you' ve got this working, you can add more complexities. If it fails at a certain point, you know immediately what's causing the error and it will be easier to look for a solution and fix your issue.

Just my two cents.
 
Irliyanti Rahmadhani Lubis
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Roel De Nijs wrote:I'm definitely not a Hibernate expert, and certainly not when it comes down to writing native queries But I think a good starting point would be the native SQL Queries chapter from Hibernate. And I would start with a very easy query (e.g. select just one field from a table). Once you' ve got this working, you can add more complexities. If it fails at a certain point, you know immediately what's causing the error and it will be easier to look for a solution and fix your issue.

Just my two cents.



Thank you, Roel, for your reference.
I'm the beginner in Java and Hibernate so I don't khow how to solved that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!