• 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
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 1714
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: 1714
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: 1714
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this in your class:
 
I knew I would regret that burrito. But this tiny ad has never caused regrets:
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!