Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Executing storedprocedure through HIBERNATE in SPRING

 
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,

I am trying to execute very simple stored procedure using HIBERNATE in SPRING.

I refer this link in javaranch but couldn't solve the problem.

I paste the code snap here one by one:

1)This is my Login.hbm.xml file





2)DaoImplimentation file



3)xxx-servlet mapping file (just part of file)




4)POJO ...
It is having four fields that which i return from stored procedure so i dont include the code.

5)Stored procedure




I am using SQL server 2000...

When i run the application i could login (authentication through database so can connect to DB ) very well.

but getting this exception..



I feel that i am near to solve it..

thanks

Vishal Pandya
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks as though your query is not working quite right. I don't see the issue, but do a google search on "COUNT field incorrect or syntax error". Most of the results point toward a query syntax error.

Best of luck.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I personally, havent used stored proceedures with Hibernate. I looked up the
Hibernate Documentation and it mentioned:


Recommended call form is standard SQL92: { ? = call functionName(<parameters>) } or { ? = call procedureName(<parameters>}.



However, your mapping file has:


{ call test_proc(?) }



Shouldnt this have been



And by the way, as per one of the documents that i saw, the "COUNT field incorrect or syntax error" occurs because

You are trying to insert a record into a database field that has a question mark in its field name.


[ August 30, 2007: Message edited by: Jaikiran Pai ]
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Nathan Hook:
It looks as though your query is not working quite right. I don't see the issue, but do a google search on "COUNT field incorrect or syntax error". Most of the results point toward a query syntax error.

Best of luck.



hello Nathan,

Thanks for your suggestion and i did google for it. and i did scan the query syntax again but the same problem persist.

Vishal Pandya
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Jaikiran Pai ,

Thanks for your reply...

1)
I tried the way you suggested { ? = call test_proc() } but getting the same exception.


2)

You are trying to insert a record into a database field that has a question mark in its field name.



I don't have any field containing ? that you would have checked from Login.hbm.xml file.

Vishal Pandya
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends ,

I am also expecting some expert comments from our moderators for ORM Paul Sturrock, Mark Spritzler for this problem.

Thanks,
Vishal Pandya
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic