• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Bad sql grammer

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Greenhorn
Posts: 4
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic