• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bad sql grammer

 
raj chopra
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

My project involves struts1.2,springs1.2,hibernate 3.0

To display few details in the jsp page , i wrote a query in dao layer and created the related pojo files and hbm files etc
query is :

" select billingaddress.billingaddressLine1,billingaddress.billingaddressLine2,billingaddress.city,billingaddress.firstName,billingaddress.middleName,billingaddress.lastName,"+
" billingaddress.pager,"+
" billingaddress.altPhone,billingaddress.officePhone,billingaddress.cellular,"+
" billingaddress.state,billingaddress.zip,billingaddress.email"+
" from SBBillingAddress billingaddress"+
" where memberid =?"

Below i mention the exception

 
Sai Rao
Greenhorn
Posts: 4
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Raj, Have you checked if the table SBBillingAddress has a field labelled 'Memberid'? Or is it 'member_id'? Please verify the column name used - it seems to be the likely cause of the error you have posted.
 
raj chopra
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sai,

thanks for reply,

Sai Rao wrote:Hello Raj, Have you checked if the table SBBillingAddress has a field labelled 'Memberid'? Or is it 'member_id'? Please verify the column name used - it seems to be the likely cause of the error you have posted.


I have cross checked my table in database, pojo class(SBBillingAddress), and hbm file(SBBillingAddress.hbm.xml) all are fine.
also one more thing is that memberid is defined as primary key in hbm file.
 
Reddy Prashanth
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your query use "where billingaddress.memberid =?" instead of "where memberid =?"
 
raj chopra
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi prashanth,
Thanks for reply,

Reddy Prashanth wrote:In your query use "where billingaddress.memberid =?" instead of "where memberid =?"


Problem got solved.thanks a ton
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic