This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

help with nativeQuery  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I have tried to do the query using expression constructors and jpql, but jpql does not support subqueryes and then, i am trying to do with nativeQuery. It's possible?

I'm getting an error message. Would anyone know why?

The query is as follows:




The Query at the Console is



It runs in mysql and returns results correctly, but in the class I'm testing the following error occurs:

 
Ranch Hand
Posts: 1709
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, does the column "codigo" exist in the table  Usuario in the mySQL database? Or, does the codigo attribute in the Usuario entity mapped to another name in the table?
 
RafaelCarvalho Moreira
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my table Usuario and the column "codigo" exist in the table.

 
Himai Minh
Ranch Hand
Posts: 1709
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe, try to run a simple native query like "select codigo from Usuario " and see if  the column can be found.
 
RafaelCarvalho Moreira
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have done your advice and occured an error .





 
Himai Minh
Ranch Hand
Posts: 1709
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this in your class:
 
Those who dance are thought mad by those who hear not the music. This tiny ad plays the bagpipes:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!