Win a copy of Head First Android this week in the Android 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Error in named native query (Invalid Column Name)

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi There,

I am trying to get a native query work. I put it in a mapping file:



The code to have it is the following:



Strangely, I got the exception:



Any ideas??
Many Thanks in advance.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dominique,

how is someone supposed to solve a problem with a query on a table if the table layout is unknown? Sorry, I can't do that, my crystal ball is currently in repair...

Post some info on the table you are querying or a mapping file that produces the query. Then, maybe someone can help...

CU
Froestel
 
Dominique Von Hofcheirken
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Andreas,

you're right!:P
However, I solved the issue.
The problem is that Hibernate tries to retrieve all mapped columns specified for DataValues objects, even if I specified only to get tow of them in the following named query in the mapping document:



Then the strange error:
could not read column value from result set: PK1_8_0_; Invalid column name

Then, I created a new mapping document and a new mapped object to exactly fit the query:



Do you think it's a normal behavior?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic