This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Executing storedprocedure through HIBERNATE in SPRING

 
Vikas Kapoor
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
 
Nathan Hook
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.
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic