Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic