aspose file tools*
The moose likes Object Relational Mapping and the fly likes Request processing failed; nested exception is org.hibernate.exception.SQLGrammarException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Request processing failed; nested exception is org.hibernate.exception.SQLGrammarException" Watch "Request processing failed; nested exception is org.hibernate.exception.SQLGrammarException" New topic
Author

Request processing failed; nested exception is org.hibernate.exception.SQLGrammarException

Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 113

Hello,
I am using Spring, Hibernate and MySQL for my project. I have configured hibernate in spring using the AnnotationSessionFactoryBean as shown below


My hibernate.cfg.xml file is as follows



My Model calss is as follows:

My DAO and DAO impl class is as follows

The DAO Impl class is:

I am getting the following error and i am not able to make out what the problem is.


Please help.
Thank you.


Regards,
Deepak

Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1672
    
    7

Well it says your table does not exist. Do you see the log statements printing out that your table is being created?

If your schema is already existing and I am imagining it is you can try using:



Its possible create cannot add the table to an existing schema but I can't remember.

The other thing you could try is defining your schema explicitly on your table:



If you do that btw you don't need to specify the schema in your connection details (although I don't think it hurts if you do)

Good luck,


[How To Ask Questions][Read before you PM me]
Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 113

Dear Bill,
The problem was resolved. It was a silly and a stupid mistake. The Id field in my Entity class was of type String and it also has the @GeneratedValue annotation. So it is quite obvious that we can't auto increment a field with String datatype. It can only be done on the int field.
Thank you
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1672
    
    7

Glad you got it figured out! I did not even look that close at your mappings since the error complained of a table not existing.. I am sure the cause of that was further up your stack trace in the table generation output
Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 113

Yes Bill, it was further up the stack where no one will normally look at with such an error message. Thanks though for youy help.
Cheers
Deepak.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Request processing failed; nested exception is org.hibernate.exception.SQLGrammarException