*
The moose likes Object Relational Mapping and the fly likes Executing storedprocedure through HIBERNATE in SPRING Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Executing storedprocedure through HIBERNATE in SPRING" Watch "Executing storedprocedure through HIBERNATE in SPRING" New topic
Author

Executing storedprocedure through HIBERNATE in SPRING

Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
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

Joined: Jan 10, 2005
Posts: 81
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

Joined: Jul 20, 2005
Posts: 10264
    
168

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 ]

[My Blog] [JavaRanch Journal]
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
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

Joined: Aug 16, 2007
Posts: 1374
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

Joined: Aug 16, 2007
Posts: 1374
Hello friends ,

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

Thanks,
Vishal Pandya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Executing storedprocedure through HIBERNATE in SPRING