• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate SQLGrammarException

 
Amit kull
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my mapping XML I have


When I write a hql query like:
I get exception :
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)

Could someone please help me with this? If I don't use aggregate function min() then I get valid data with the rest of the query kept same but retrieving other column (Other than subscriberID) values from Subscriber table like say subscriberName.
So I guess it is a problem with generator class="sequence"

The project is already in production and I cannot change the mappings just for the enhancement issue I am working on. So could you suggest some solution?
Thanks.

[ October 21, 2008: Message edited by: Amit kull ]

[ October 21, 2008: Message edited by: Amit kull ]
[ October 21, 2008: Message edited by: Amit kull ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

So I guess it is a problem with generator class="sequence"

This is unlikely. The generation strategy is not going to matter when you are querying - no key generation is taking place after all.

What is more likely is the misplaced comma after Subscribers.
 
Amit kull
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Paul.
But the comma is not there in actual code. I just made typo while posting the topic here.
I will now edit the query. Meanwhile let me know any other probable causes of this exception.
Thanks, again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic